public void GetCountFBMOnCurrenUserDepartment() { /* On launching the FBM Module, if current user's having the FBM in draft then only Draft option would select * Otherwise Sent option will select automatically. */ int?deptid = null; if (ViewState["DeptID"] != null) { deptid = Convert.ToInt32(ViewState["DeptID"].ToString()); } DataTable dt = BLL_FBM_Report.GetCountFBMOnCurrenUserDepartment(deptid); if (ViewState["USERTYPE"].ToString().ToUpper() == "ADMIN") { optMsgType.SelectedValue = "PENDINGAPPROVAL"; DDLOfficeDept.SelectedValue = ViewState["DeptID"].ToString(); } else { if (dt.Rows.Count > 0) { optMsgType.SelectedValue = "DRAFT"; DDLOfficeDept.SelectedValue = ViewState["DeptID"].ToString(); } else { optMsgType.SelectedValue = "SENT"; DDLOfficeDept.SelectedValue = "0"; ViewState["DeptID"] = "0"; } } }