Deepak Mishra

Deepak Mishra

  • NA
  • 109
  • 1.8k

Hidden fields are giving error [hidden field does not exist

Feb 21 2019 4:02 AM
Hidden fields are giving error if I am using in DAL(Data Access Layer) =
hidden field does not exist in current context .
 
When I am using in single page means, this code in inline page then its working fine.
Please tell me how to pass hidden fields from Presentation Layer to DAL. or Where to write this code  so that it will not give the error like (hidden field does not exist in current context .)
 
protected void btnSave_Click(object sender, EventArgs e)
{
con.Open();
cmd = new SqlCommand("spRegistrationSaveOrUpdate", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@EmployeeId", (hfEmployeeId.Value == "" ? 0 : Convert.ToInt32(hfEmployeeId.Value)));
cmd.Parameters.AddWithValue("@EmployeeName", txtEmployeeName.Text);
cmd.Parameters.AddWithValue("@Designation", ddlDesignation.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Salary", txtSalary.Text);
cmd.Parameters.AddWithValue("@Email", txtEmail.Text);
cmd.Parameters.AddWithValue("@Mobile", txtMobile.Text);
cmd.Parameters.AddWithValue("@Qualification", ddlQualification.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Manager", txtManager.Text);
int i = cmd.ExecuteNonQuery();
 

Answers (1)