Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
SelectionChanged event is firing, but no actual value in SelectedItem or SelectedValue
posted

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

Parents
  • 10685
    Suggested Answer
    Offline posted

    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>

Reply Children
No Data