Click here to Skip to main content
15,891,597 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I have a data of more that 500000 records i want to search data and fill in other dropdown list
i am using ListSearchExtender with dropdown its working buts it is very slow

when i search and select first dropdown it should fill another dropdown
and when i search and select second dropdown it should fill frst dropdown..

is there any alternative way to filter data and fill ??????????????

here is my code

ASP.NET
<td class="style43" colspan="3">
                            <asp:DropDownList ID="ddlICD10" runat="server" AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged"
  > </asp:DropDownList>
                            <asp:ListSearchExtender ID="ddlICD10_ListSearchExtender" runat="server"  Enabled="True" TargetControlID="ddlICD10">   </asp:ListSearchExtender>
                           ICD10 DESCRIPTION :<asp:DropDownList ID="ddlDesc" runat="server"
                       AutoPostBack="True" Height="22px"
                                onselectedindexchanged="DropDownList2_SelectedIndexChanged" Width="319px"></asp:DropDownList>
 <asp:ListSearchExtender ID="ddlDesc_ListSearchExtender" runat="server"
    Enabled="True" TargetControlID="ddlDesc">       </asp:ListSearchExtender>


here is c# code

C#
protected void Page_Load(object sender, EventArgs e)
    {
       
                GetDDCode();

}
      protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        con.Open();
        //DataTable dt = new DataTable();
        //dt = ds.Tables[0];
        //DataRow newrow = dt.NewRow();
        //newrow = ds.Tables.
        string sql = "select Description from ICD10 where ICD10code = '" + ddlICD10.Text + "'";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.CommandType = CommandType.Text;
        SqlDataReader dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            ddlDesc.Text = dr["Description"].ToString();
        }
    }

    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        con.Open();
        string sql = "select ICD10code from ICD10 where Description = '" + ddlDesc.Text + "'";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.CommandType = CommandType.Text;
        SqlDataReader dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            ddlICD10.Text = dr["ICD10code"].ToString();
        }
    }

    public void GetDDCode()
    {
        con.Open();
        string sql = "select ICD10code,Description from ICD10";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.CommandType = CommandType.Text;
        SqlDataAdapter adp = new SqlDataAdapter();
      
        adp.SelectCommand = cmd;
        adp.Fill(ds);
        ddlICD10.DataTextField = "ICD10code";
        ddlICD10.DataValueField = "ICD10code";
        ddlICD10.DataSource = ds;
        ddlICD10.DataBind();
        ddlDesc.DataTextField = "Description";
        ddlDesc.DataValueField = "Description";
        ddlDesc.DataSource = ds;
        ddlDesc.DataBind();
        con.Close();
    }
Posted

1 solution

With huge data, I think you shouldn't fill all of them to dropdownlist directly. Instead of your way, you should use Ajax/Jquery & webservices to do that.

- Create a webservice to get the data from your db.
- Use autocomplete when searching your data.
 
Share this answer
 
Comments
$ultaNn 9-Jun-13 11:50am    
i used webservice and auto complete
still its aking time to search/...
ChienVH 9-Jun-13 12:02pm    
Try minLength property of autocomplete method to indicate how many characters entered then searching. Maybe the performance will be reduced.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900