DataView DvSRM; // For Stakeholder Relationship Manager Details View /// <summary> /// Page load Method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // To set Selected accordion open Accordion MasterAcc = (Accordion)Master.FindControl("acdnMaster"); int Ind = MasterAcc.SelectedIndex; int Index = Convert.ToInt16(Session["SrNo"]); MasterAcc.SelectedIndex = Index - 1; // To select loginuser id and login username Login objSRM = new Login(); objSRM.Start(); UserName = objSRM.LogedInUser; LoginUser = objSRM.LoginUser; Ret = objSRM.Ret; if (!Page.IsPostBack) { IsActive = true; // To sort defaulty by Ascending order ViewState["Sort"] = "ASC"; // To fetch Stakeholder Relationship Manager details having active status DataTable DtSRM = SRMActiveDetails(IsActive); ViewState["DtSRM"] = DtSRM; if (DtSRM.Rows.Count > 0) { BindSRM(DtSRM); } else { GrdSRM.DataSource = null; GrdSRM.DataBind(); } } }
/// <summary> /// To bind Stakeholder Relationship Manager details in grid /// </summary> /// <param name="DtSRM"></param> private void BindSRM(DataTable DtSRM) { if (DtSRM.Rows.Count > 0) { GrdSRM.DataSource = DtSRM; GrdSRM.DataBind(); for (int i = 0; i < GrdSRM.Rows.Count; i++) { Label lblPLUser = (GrdSRM.Rows[i].FindControl("lblUser") as Label); Label lblStatus = (GrdSRM.Rows[i].FindControl("lnkStatus") as Label); LinkButton lnkStatus = (GrdSRM.Rows[i].FindControl("lnkEdit") as LinkButton); string Status = lblStatus.CssClass.ToString(); if (Status == "True") { lblStatus.Text = "Active"; lnkStatus.Text = "Deactivate"; lnkStatus.Font.Underline = true; } else { lblStatus.Text = "InActive"; lnkStatus.Text = "Activate"; lnkStatus.Font.Underline = true; } } } else { GrdSRM.DataSource = null; GrdSRM.DataBind(); } }