DropDownList1.SelectedValue= fn;
/*error here* Object reference not set to an instance of an object*/
No need of this
string fn= dt.Rows[0]["CategoryId"].ToString();
string sn = dt.Rows[0]["CategoryName"].ToString();
DropDownList1.SelectedItem.Text = fn;
filldropdown2(fn);
DropDownList2.SelectedItem.Text= sn;
The
selectedText
of
dropdown
will be automatically get selected, because you are binding
DropdownList
before going to edit().
Thanks
Ashish