private void dataBind() { SqlDataSource1.SelectParameters.Clear(); if (PatIDSearch.Text == "" && TextBoxtiltleSearch.Text == "") { SqlDataSource1.SelectCommand = " select p.ID,p.Title,p.Entry_Status,s.StatusName as Filling_Status from Patent_Data p,Patent_Status s where p.Filing_Status=s.Id and p.Filing_Status='GRN'"; } else if (PatIDSearch.Text != "" && TextBoxtiltleSearch.Text == "") { SqlDataSource1.SelectCommand = " select p.ID,p.Title,p.Entry_Status,s.StatusName as Filling_Status from Patent_Data p,Patent_Status s where p.Filing_Status=s.Id and p.ID LIKE '%'+@ID+'%' and p.Filing_Status='GRN' "; SqlDataSource1.SelectParameters.Add("ID", PatIDSearch.Text.Trim()); } else if (PatIDSearch.Text == "" && TextBoxtiltleSearch.Text != "") { SqlDataSource1.SelectCommand = " select p.ID,p.Title,p.Entry_Status,s.StatusName as Filling_Status from Patent_Data p,Patent_Status s where p.Filing_Status=s.Id and p.Title LIKE '%'+@Title+'%' and p.Filing_Status='GRN' "; SqlDataSource1.SelectParameters.Add("Title", TextBoxtiltleSearch.Text.Trim()); } else { SqlDataSource1.SelectCommand = " select p.ID,p.Title,p.Entry_Status,s.StatusName as Filling_Status from Patent_Data p,Patent_Status s where p.Filing_Status=s.Id and p.ID LIKE '%'+@ID+'%' and p.Title LIKE '%'+@Title+'%' and p.Filing_Status='GRN' "; SqlDataSource1.SelectParameters.Add("ID", PatIDSearch.Text.Trim()); SqlDataSource1.SelectParameters.Add("Title", TextBoxtiltleSearch.Text.Trim()); } GridViewSearchPatent.DataBind(); SqlDataSource1.DataBind(); GridViewSearchPatent.Visible = true; }
protected void GridViewSearchPatent_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridViewSearchPatent.PageIndex = e.NewPageIndex; GridViewSearchPatent.DataBind(); dataBind(); }