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
155
WebDropDown does not add DropdownItem & SelectionChanged fires incorrectly.
posted

Hello There,

I am just trying to create a simple web drop down from sql data source. I also want to add "All" as my first option. I can't add dropdownitem "All" to the webdropdown.

Also, I want the SelectionChanged event fired (and auto postbak the form) when I select an item. I want to use the auto complete feature as well. But they are not working correctly. 

Here is my .aspx code:

<ig:WebDropDown  

                            AutoFilterQueryType="Contains"

                            DataSourceID="SqlDataSourceEmployees" 

                            DisplayMode="DropDown"

                            DropDownContainerHeight="300px" 

                            EnableAutoFiltering="Client"

                            EnableViewState="false" 

                            EnableAutoCompleteFirstMatch="false" 

                            ID="DDLEmployee" 

                            OnPreRender="DDLEmployee_PreRender" 

                            runat="server"

                            Width="150px" >

                <Items>

                    <ig:DropDownItem Text="All" Value="0"></ig:DropDownItem>

                </Items>      

                <DropDownItemBinding TextField="EmpNamel" ValueField="EmpID" />

                <ClientEvents />                     

                <AutoPostBackFlags SelectionChanged="On" /> 

            </ig:WebDropDown>

And here is my SelectionChanged event in code behind.

    Protected Sub DDLEmployee_SelectionChanged(ByVal sender As Object, ByVal e As Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs) Handles DDLEmployee.SelectionChanged

 

    End Sub

Please help me to make this work. This is really frustrating and should have been pretty straight forward.

P.S: The database table only have less than 50 items to load to the web drop down.

Parents
  • 37874
    posted

    Hi vellabadu,

     

    I have been reading through your post and the code you have provided seems to be correct. The page should be posted back on every selection change and the corresponding event should be fired. I would suggest that you try adding new items on DataBound event of the WebDropDown:

     

        protected void WebDropDown1_DataBound(object sender, EventArgs e)

        {

            DropDownItem item = new DropDownItem();

            item.Text = "Some Text";

            item.Key = "Test";

            WebDropDown1.Items.Insert(0, item);

        }

     

    Please let me know if this helps.

Reply Children
No Data