Unable to assign int value to Hidden Field
I am trying to assign an int variable value to a hidden field value, but its not working. Can anyone help?
Below is my code -
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPost)
{
int Id= 0;
if (Request.QueryString["Id"] != null && Request.QueryString["Id"] != "")
{
MyId = Convert.ToInt32(Request.QueryString["Id"]);
}
else
{
Id = -1;
}
hiddenId.Value =Id;
}
}