When WebDropDown on UpdatePanel is filled with data it shows first item from its data source.
In code behind when I handle link button click it claims that SelectedValue = null, although from user point of view there is some selection visible on the screen.
What should I do to get selected value properly?
Nothing special here I guess :
<ig:WebDropDown ID="cmbUN" runat="server" DataSourceID="ADR_uny" TextField="un_str"Width="200px" DropDownContainerWidth="300px" EnableAutoFiltering="Client" ValueField="id_un"><DropDownItemBinding TextField="un_str" ValueField="id_un" /></ig:WebDropDown>
Hello, In order to get selected value, I would recommend you to handle SelectionChanged event which will fire when post back is caused after selection is made as shown below:
protected void WebDropDown1_SelectionChanged(object sender, Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs e)
{ string nwsel= e.NewSelection.ToString(); }
I hope this helps.
Please consider following scenario:
User selects something on grid, selection causes postback we have selected row ID.Combo is filled with data from datasource which took selected row id as a query parameter.
From customer point of view combo is showing something, so there is no need to perform a selection, no event is triggered to be handled.Customer clicks something else, code behind checks that there is nothing selected in combo. We show error msg - "please select item in combo"
"Hey, what the heck!?" customer asks - "I do see some selection in combo, why should I click it again?!".
Customer is right. Always right.Customer is annoyed and reports error to me.
What should I do - combo shows selection when datasource is filled, but selected item is null.
Hello,
By default, WebDropDown shows text (CurrentValue property of WebDropDown) in the WebDropDown text area. However, the item is not selected. You can select item in the WebDropDown by its index as shown below:
this.WebDropDown1.SelectedItemIndex = 1;
Let me know if that helps you.
I am just following up to see if you need any assistance with this matter.
I wrote the next code:
------------------------------------------------------------------------
ddlCCTO.SelectedItemIndex = Convert.ToInt32(e.NewSelection.ToString());
String strPaso = HttpUtility.UrlDecode(ddlCCTO.CurrentValue);
Infragistics.Web.UI.ListControls.DropDownItem lstItem = new DropDownItem(); lstItem = ddlCCTO.Items.FindItemByValue(strPaso);
intPaso = Convert.ToInt32(ddlCCTO.SelectedItem.Value.ToString());
-------------------------------------------------------------------------
The message is the same..."Object reference not set to an instance of an object."
Our company is thinking to change the library because its so dificult to use.