The reason I ask is because I have an Update Panel filled with textboxes, labels, etc. that I make visible/invisble depending on what the user clicks. Later, I run a loop to clear all the textboxes. It used to work just fine, but now that I've added the AJAX Update Panel, it gives me an "Invalid postback or callback argument" error.
Is this because of that AJAX Update Panel? Or am I doing something completely wrong on my own?
Thanks, Ellie
[EDIT]: Okay, I'm adding a whole bunch of code because I have no idea where it's coming from:
This is the method to write the record:
protected void AddEmployerRecord()
{
connection = new SqlConnection();
connection.ConnectionString = "****";
connection.Open();
newEmployer = new EmployerCRUD(connection);
employerRow.employerName = tb_employer.Text;
employerRow.empPhone = tb_phone.Text;
employerRow.empFax = tb_fax.Text;
employerRow.empEmail = tb_email.Text;
employerRow.empAddress = tb_address.Text;
employerRow.empCity = tb_city.Text;
employerRow.empState = ddl_state.SelectedValue.ToString();
employerRow.empZIP = tb_ZIP.Text;
employerRow.startDate = Convert.ToDateTime(tb_fromDate.Text);
employerRow.endDate = Convert.ToDateTime(tb_toDate.Text);
employerRow.startPay = Convert.ToDecimal(tb_startPay.Text);
employerRow.endPay = Convert.ToDecimal(tb_endPay.Text);
employerRow.leaveReason = tb_leaveReason.Text;
employerRow.supervisorFName = tb_superFName.Text;
employerRow.supervisorLName = tb_superLName.Text;
employerRow.contactForRef = rbl_contact.SelectedValue.ToString();
employerRow.jobDesc = tb_jobDesc.Text;
employerRow.applicantID = 10010;
//employerRow.applicantID = Convert.ToInt32(Session["ApplicantNum"]);
employerRow.supervisorTitle = tb_superTitle.Text;
employerRow.jobTitle = tb_jobTitle.Text;
employerRow.startPayType = ddl_startPayType.SelectedValue.ToString();
employerRow.endPayType = ddl_endPayType.SelectedValue.ToString();
ct_emp = newEmployer.Add(employerRow);
// *************** Error Message *************** //
//if (ct_emp.Message != "OK")
// Error message
//else
//
connection.Close();
}
And this is the method to load the grid:
protected void LoadGrid()
{
try
{
SqlConnection pConnection = new SqlConnection();
pConnection.ConnectionString = "**";
pConnection.Open();
string sqlstatement = "SELECT EmployerID, EmployerName FROM dbo.EMPLOYER WHERE ApplicantID = @applicantID";
command = new SqlCommand(sqlstatement, pConnection);
command.Parameters.AddWithValue("@applicantID", 10010);
//command.Parameters.AddWithValue("@applicantID", Session["ApplicantNum"].ToString().Trim());
ds = new DataSet();
adapter = new SqlDataAdapter(command);
builder = new SqlCommandBuilder(adapter);
adapter.Fill(ds);
gv_employers.DataSource = ds.Tables[0];
gv_employers.DataBind();
pConnection.Close();
}
catch (Exception error)
{
Response.Write(error.Message);
}
}
Just as a sidenote, ApplicantID is only 10010 while I debug things (need consistency).
Also, I read somewhere that this problem occurs when you try to re-bind the data to the grid. I run that LoadGrid() method each time the page is reloaded. Should I bind the data somewhere else? If so, how?