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
775
Load on demand with Generic list data
posted

Hi ,

We are using Infragistincs version 10.2 for asp.net.

We are trying do load on demand or lazy loading of 9000 records to webdropdown. These 9000 records are in a generic list. Initially the page loads and the webdropdown is filled with 20 records. When i scroll down , it is not loading the remaining list. Please suggest.

Following is the code i am trying to implement load on demand.

aspx page in form tag

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
     <ig:WebDropDown  ID="WddEmployeeMSC" runat="server" Width="200px" DisplayMode="DropDownList" TextField="Name" ValueField="Id"
     EnableMultipleSelection="false" EnableViewState="false"  EnableLoadOnDemand="true" LoadingItemsMessageText="Loading"   EnableAutoFiltering="Server"  >   
    
    </ig:WebDropDown>
    <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" />
    <asp:Button ID="btnPopulate" Text="PopulateData" runat="server" OnClick="btnPopulate_Click" />
    </div>
    </form>

Following is the code behind and a class to create and bind generic list to webdropdown.

 protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var text = WddEmployeeMSC.SelectedValue;
            var value = WddEmployeeMSC.SelectedValue;
        }

        protected void btnPopulate_Click(object sender, EventArgs e)
        {
            List<NameList> NameList = new List<NameList>();
            NameList name;
            for (int i = 1; i < 8500; i++)
            {
                name = new NameList() { Name = "Name" + i, Id = i };
                NameList.Add(name);
            }

            WddEmployeeMSC.DataSource = NameList.ToList();
            WddEmployeeMSC.ValueField = "Id";
            WddEmployeeMSC.TextField = "Name";
            WddEmployeeMSC.DataBind();
            WddEmployeeMSC.Items.Insert(0, new DropDownItem("All", "All"));
        }

Following is the class

 class NameList
    {
     
        public int Id { get; set; }
        
        public string Name { get; set; }
    
    }

Thanks in advance.