Anjali Khan

Anjali Khan

  • NA
  • 867
  • 224.8k

how to solve erroe in my cs page with dropdown list in asp.n

Nov 29 2017 1:34 AM
hi frnds getting error like in my drop down list 
 
 
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 1528: ncmdbObject.Dispose();
Line 1529: }
Line 1530: }
Line 1531:
Line 1532: #endregion
  and my cs page this 
 
 
public void bindropDownDepartment()
{
try
{
objDiaryOB.RoleId = Convert.ToInt32(Session["Role_Id"]);
objDiaryOB.ModuleId = Convert.ToInt32(Request.QueryString["ModuleID"]);
p_Var.dSet = obj_miscelBL.GetDepartment(obj_userOB);
if (p_Var.dSet.Tables[0].Rows.Count > 0)
{
p_Var.sbuilder.Remove(0, p_Var.sbuilder.Length);
p_Var.dSet = null;
p_Var.dSet = obj_miscelBL.GetDepartment(userObject);
trdepartmrnt.Visible = true;
ddlDepartName.DataSource = p_Var.dSet;
ddlDepartName.DataTextField = "Deptt_Name";
ddlDepartName.DataValueField = "Deptt_Id";
ddlDepartName.DataBind();
}
p_Var.dSet = null;
}
catch
{
throw;
}
}
 

Answers (7)