protected void BtnPatentSearch_Click(object sender, EventArgs e)
    {
        if (Txtid.Text.Trim() == "")
        {
            string CloseWindow1 = "alert('Please Enter Patent Id')";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            GridViewPatentSearch.DataSourceID = "SqlDataSource1";
            GridViewPatentSearch.DataBind();
            GridViewPatentSearch.Visible = true;
        }

        else
        {
            string type     = Txtid.Text.Substring(0, 2);
            string PatentId = Txtid.Text.Trim();
            SqlDataSource1.SelectParameters.Clear();
            SqlDataSource1.SelectParameters.Add("ReferenceNumber", PatentId);

            SqlDataSource1.SelectCommand = "select  MemberId,UPPER(InvestigatorName) as MemberName,ReferenceNumber from Member_Incentive_Point_Transaction, Patent_Inventor where Patent_Inventor.EmployeeCode=Member_Incentive_Point_Transaction.MemberId and " +
                                           "TransactionType='PPE' and ReferenceNumber=@ReferenceNumber and Patent_Inventor.Id=Member_Incentive_Point_Transaction.ReferenceNumber ";

            GridViewPatentSearch.DataSourceID = "SqlDataSource1";
            GridViewPatentSearch.DataBind();
            GridViewPatentSearch.Visible = true;
        }

        ModalPopupExtender1.Show();
    }
    protected void GridViewPatentSearch_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridViewPatentSearch.Visible = true;
        GridViewRow row      = GridViewPatentSearch.SelectedRow;
        string      memberid = row.Cells[1].Text;

        txtmemberPatent.Text = memberid;
        GridViewPatentSearch.DataBind();
    }
 protected void Button3_Click(object sender, EventArgs e)
 {
     Txtid.Text = "";
     GridViewPatentSearch.DataBind();
 }