mary jean ligas

mary jean ligas

  • NA
  • 420
  • 196.2k

Filter a Gridview using textbox that was already bind

Nov 28 2014 4:51 AM

I want to filter a gridview that was already bind from the sql command and from the textchanged of the textbox the gridview will filter but it will never execute again the sql command it will filter all the rows that was already on the gridview.

heres my snippet:

in code behind:

 protected void Page_Load(object sender, EventArgs e)
        {

string query = "exec sp_GetCustomer_Info 'MOTHER','" + plant.ToString() + "','" + so.ToString() + "','" + chain.ToString() + "','" + channel.ToString().Replace("'", "") + "'," + "''" + "";

                List<tmpGetCustomerZone> zone = context.ExecuteQuery<tmpGetCustomerZone>(query).ToList();
                gridCustomer.DataSource = zone;
                gridCustomer.DataBind();
                gridCustomer.Visible = false;

}


then in textchanged:

protected void txtCustomer_TextChanged(object sender, EventArgs e)
{
gridCustomer.Visible = true;
??//don't know whats next
}


DESIGN PAGE:


<asp:TextBox ID="txtCustomer" runat="server" AutoPostBack="true" txtCustomer_TextChanged></asp:TextBox>
<asp:GridView ID="gridCustomer" runat="server" CssClass="normalcaption"></asp:GridView>


Please help :(





Answers (1)