Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Filter recors and fill in drop down with huge sql data

$
0
0

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..

<b>is there any alternative way to filter data and fill ??????????????</b>

here is my code

<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




 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();
    }


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>