I must be missing something because the event fires, but I don't see any value when looking through the properties of the WebDropDown object.
I have obviously AutoPostback enabled and have selected the SelectionChanged property set to ON in AutoPostBackFlags.
This is an ASP.NET solution. The data is found to entries from a database and the values do load property when the page loads.
Thoughts?
Paul
Hello, Thank you for posting in our community! You could access the WebDropDown selected item value from SelectionChanged using either one of the following lines of code.
var selChabgedValue1 = this.WebDropDown1.SelectedValue; var selChabgedValue2 = WebDropDown1.SelectedItem.Value;
In order to better illustrate/recreate this, I am showing the relevant code as well.
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (WebDropDown1.SelectedItem!=null) { var value = WebDropDown1.SelectedItem.Value; } } } protected void WebDropDown1_SelectionChanged(object sender, Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs e) { var selChabgedValue1 = this.WebDropDown1.SelectedValue; var selChabgedValue2 = WebDropDown1.SelectedItem.Value; }
<form id="form1" runat="server"> <div> <ig:WebScriptManager ID="WebScriptManager1" runat="server"> </ig:WebScriptManager> <ig:WebDropDown runat="server" Width="200px" ID="WebDropDown1" AutoPostBackFlags-SelectionChanged="On" OnSelectionChanged="WebDropDown1_SelectionChanged" > <Items> <ig:DropDownItem Text="11111" Value="1"> </ig:DropDownItem> <ig:DropDownItem Text="22222" Value="2"> </ig:DropDownItem> <ig:DropDownItem Text="33333" Value="3"> </ig:DropDownItem> </Items> </ig:WebDropDown> </div> <asp:Button runat="server" Text="PostBack" /> </form>
Your response tipped me on something I wasn't doing in my page_load method. I initialize some fields and drop-downs in the ASP.NET page and what I was not doing is performing the initializing with the following "IF" clause:
if (!IsPostBack) {
//initialize stuff
}
Performing the initialization cleared the selected value variable.