HI
In manager.aspx page I have gridview that bind product information from database in this gridview I define linkbutton EDIT that when users click on it they go to Edit.aspx page and in this page users can see their product information and Edit them
in Edit.aspx page I use some textbox and dropdownlist and bind them from database
int data1 = Convert.ToInt32(Request.QueryString["Id"].ToString());
SqlCommand _cmd = new SqlCommand("viewProduct", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cmd.Parameters.AddWithValue("@id", data1);
_cn.Open();
SqlDataReader _dr = _cmd.ExecuteReader();
while (_dr.Read())
{
txtname.Text = _dr["Name"].ToString();
txtmodel.Text = _dr["Model"].ToString();
CKEditorControl1.Text = _dr["Description"].ToString();
DDL1.Items.FindByText(_dr["classification"].ToString()).Selected = true;
DDL2.Items.FindByText(_dr["subset"].ToString()).Selected = true;
}
_cn.Close();
when I click on EDIt linkbutton from gridview it go to Edit.aspx page and bind all data from database and ofcourse show data in Dropdownlist untill now every thing is ok
but when I change some Item in this page i.e Name of product when I changed and clicked on button to update table in database it update data in database but below error happen too
Server Error in '/behtop website' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 79:
Line 80:
Line 81: DDL1.Items.FindByText(_dr["classification"].ToString()).Selected = true; Line 82: DDL2.Items.FindByText(_dr["subset"].ToString()).Selected = true;
Line 83:
|
and when I back to manager.aspx and again click on Edit linkbutton to Edit that product it didn't load Edit.asp page and above error happen again
this error happen just when I want edit product information in other time if I don't edit any thing edit.aspx page load successfully
BestRegards