You should always check your sessions before using it, otherwise it'll give
NullReferanceException
.
Try this:
if (IsPostBack == false)
{
FillDD();
if(Session["DETAILS"] != null){
if (Session["DETAILS"].ToString() == "NEW")
{
Label1.Text = "NEW SUB CATEGORY DETAILS [ADD]";
DropDownList1.Focus();
}
else if (Session["DETAILS"].ToString() == "EDIT")
{
if (Session["SCID"].ToString() != "")
{
Label1.Text = "EDIT SUB CATEGORY DETAILS [EDIT]";
Label12.Text = Session["SCID"].ToString();
Session["SCID"] = "";
GetDetails();
DropDownList1.Focus();
}
}
}
}
--Amit