Ashish

Ashish

  • NA
  • 11
  • 452

declaring link button value globally

Aug 9 2017 3:32 AM
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)