When I search the Data by using Two Textboxes and Press Button the Data is Filled in Gridview. I set Allow Paging =True
.When i Try to move from First Page to Second Page in Gridview ,gridview will dissapper.
My Code
<asp:GridView runat="server" ID="Gv1" EmptyDataText="No Recorde Found"
AllowPaging="true" AutoGenerateColumns="false" PageSize="10"
OnPageIndexChanging="Gv1_PageIndexChanging"
OnRowCommand="Gv1_RowCommand" >
--
protected void Gv1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
Gv1.PageIndex = e.NewPageIndex;
LoadGrid();
}
Try like this
protected void btnSearch_Click(object sender, EventArgs e)
{
if (ddl1.SelectedIndex > 0 )
{
x = ddl1.SelectedItem.ToString();
}
if (ddl2.SelectedIndex > 0) {
y = ddlProgram.ddl2.ToString();
}
BindGrid();
}
private void BindGrid() {
if (ViewState["mySearchedData"] != null) {
gv.DataSource = ViewState["mySearchedData"];
gv.DataBind();
}
else
{
gv.DataSource = wcfobj.GetData(x,y);
gv.DataBind();
ViewState["mySearchedData"]= wcfobj.GetData(x,y);
}
}