Using 2009.1 controls.
I've added a WebDropdown to my edititemtemplate in a formview. I've enabled multiselect and bound it to a datasource.
<ig:WebDropDown ID="WebDropDown1" runat="server" DataSourceID="SqlDataSource_SystemTypes" TextField="Item_Text" ValueField="Item_Value" DropDownAnimationType="Linear" DropDownContainerHeight="0px" DropDownContainerMaxHeight="0px" DropDownContainerWidth="0px" EnableDropDownAsChild="True" EnableMultipleSelection="True" MultipleSelectionType="Checkbox" PageSize="0" Width="100%"> </ig:WebDropDown>
The webDropdown is visible (aside from the dropdown arrow graphic whereever that is supposed to exist) and it is populated properly.
I can check multiple items. Looks good.
When I handle my formview_updating event to grab the selections so I can stuff them in a table, I have only the items I initially selected when the formview was databound. No items that I have checked on the form are marked as selected in the webdropdown.items or selecteditems collections.
How depressing.
Is there some way to reliably access the selected items?
Hello,
I've tried to reproduce the issue but without success.
Please see my code in FormView1_Item_Updateing handler:
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
WebDropDown wdd = (WebDropDown)FormView1.FindControl("WebDropDown1");
List<DropDownItem> items = wdd.SelectedItems;
foreach (DropDownItem item in wdd.Items)
if (item.Selected) {
Debugger.Break();
}
Here I am able to get the selected Items.
In your code in the same Event you do only this:
Dim ThisWebDropDown As WebDropDown = CType(Me.FormView1.FindControl("WebDropDown1"), WebDropDown)
but not actually access the Items of the control.
You try to reach the items of the control in FormView1_DataBound Event handler : as invoke this method - Me.PopulateSystemTypes(); , So , since I'm not able to run your code I would suggest you to try get the selected Items in FormView1_ItemUpdating not in FormView1_DataBound. handler.
Let me know the result.
Thank you for the code,
I will run it and let you know what is going on.
I'll actually attach the code this time (sorry)..
Attached is my page and masterpage. I'm trying is a couple of places in the vb code to cycle through the items collection to see which items are selected - the only item I ever see selected is the one I selected on load. The selectedItems collection only shows the single item as well. This is after I run in debug mode, open the page, and make multiple selections on the webdropdown.
After fighting with the project upgrade add-in which doesn't work and doesn't create a log, I used the Project Upgrade Utility (stand-alone) and have upgraded the project to 2009.2, and my 2009.2 apparently has the 20092_SR_2025 patch installed.
Same problem.
I'll post code shortly.