if (!IsPostBack) { ddlHeader.Items.Insert(0, "---Select---"); ddlHeader.Items.Insert(1, "ApplicantID"); ddlHeader.Items.Insert(2, "ApplicantName"); GridView2.DataSource = applic.ShowApplicant(); GridView2.DataBind(); } <pre lang="C#"> <b>Method 1</b> public DataSet GetApplicantDataByID(string ApplicantID) { ds = new DataSet(); ds = SqlHelper.ExecuteDataset(con, CommandType.Text, "select * from Applicant where ApplicantId='"+ApplicantID +"'"); return ds; } <b>Method 2</b> public DataSet GetApplicantDataByName(string Name) { ds = new DataSet(); ds = SqlHelper.ExecuteDataset(con, CommandType.Text, "select * from Applicant where ApplicantName='" + ApplicantName + "'"); return ds; } <pre lang="C#">GetApplicantDataByID(txtApp.Text) &lt;pre lang=&quot;C#&quot;&gt;protected void btnSearchApplicant_Click(object sender, EventArgs e) { if (ddlHeader.SelectedIndex == 1) { GridView2.DataSource = applic.GetApplicantDataByID(txtApp.Text); GridView2.DataBind(); } else if (ddlHeader.SelectedIndex == 2) { GridView2.DataSource = applic.GetApplicantDataByName(txtApp.Text); GridView2.DataBind(); } else { btnSearchApplicant.Visible=false; txtApp.Visible=false; } }&lt;/pre&gt;</pre></pre>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)