1
Answer

declaring link button value globally

Ashish

Ashish

7y
139
1
public void view_onclick(object sender, EventArgs e)
{
int id = Convert.ToInt32((sender as LinkButton).CommandArgument);
SqlDataAdapter ad = new SqlDataAdapter("viewmasterid", con);
ad.SelectCommand.CommandType = CommandType.StoredProcedure;
ad.SelectCommand.Parameters.AddWithValue("@id", id);
DataTable dt = new DataTable();
ad.Fill(dt);
con.Close();
HiddenField1.Value = id.ToString();
txtname.Text = dt.Rows[0]["Name"].ToString();
txtage.Text = dt.Rows[0]["Age"].ToString();
}
 
 
 
how can i use this id value globally in my project? 
Answers (1)