do like this...
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SqlConnection cn = new SqlConnection("Connection");
cn.Open();
string strSQL;
strSQL = "SELECT * FROM Orders";
SqlDataAdapter da = new SqlDataAdapter(strSQL, cn);
DataSet ds = new DataSet();
da.Fill(ds, "DB");
GridView1.DataSource = ds;
GridView1.DataBind();
cn.Close();
Label2.Visible = false;
TextBox2.Visible = false;
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = GridView1.SelectedRow.Cells[1].Text;
if (TextBox1.Text == "Installment")
{
Label2.Visible = true;
TextBox2.Visible = true;
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
Or
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = GridView1.SelectedRow.Cells[1].Text;
TextBox1_TextChanged(sender, e);
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
if (TextBox1.Text == "Installment")
{
Label2.Visible = true;
TextBox2.Visible = true;
}
}