public void BindFBMReport() { int rowcount = ucCustomPagerItems.isCountRecord; string deptid = (ViewState["DeptID"] == null || ViewState["DeptID"].ToString() == "0") ? null : (ViewState["DeptID"].ToString()); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_FBM_Report.FBMMessageSearch(UDFLib.ConvertIntegerToNull(Session["userid"].ToString()), null , UDFLib.ConvertIntegerToNull(deptid), optForUser.SelectedValue.ToString().Trim() , Convert.ToInt32(optMsgStatus.SelectedValue.ToString()) , UDFLib.ConvertIntegerToNull(DDLPrimaryCategory.SelectedValue), UDFLib.ConvertIntegerToNull(DDLSecondryCategory.SelectedValue) , UDFLib.ConvertStringToNull(ddlYear.SelectedValue), UDFLib.ConvertDateToNull(txtFromDate.Text) , UDFLib.ConvertDateToNull(txtToDate.Text), txtSearch.Text, ViewState["ISDEPTSARCHONSENT"].ToString(), optMsgType.SelectedValue.ToString() , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (ds.Tables[0].Rows.Count > 0) { gvFBMReport.DataSource = ds.Tables[0]; gvFBMReport.DataBind(); if (ViewState["ID"] == null) { ViewState["ID"] = ds.Tables[0].Rows[0]["ID"].ToString(); //gvFBMReport.SelectedIndex = 0; } // SetRowSelection(); } else { gvFBMReport.DataSource = ds.Tables[0]; gvFBMReport.DataBind(); } }