/// <summary> /// To bind Content developer details in gridview /// </summary> /// <param name="DtConDev"></param> private void BindConDev(DataTable DtConDev) { if (DtConDev.Rows.Count > 0) { GrdContentDeveloper.DataSource = DtConDev; GrdContentDeveloper.DataBind(); for (int i = 0; i < GrdContentDeveloper.Rows.Count; i++) { Label lblCDUser = (GrdContentDeveloper.Rows[i].FindControl("lblUser") as Label); Label lblStatus = (GrdContentDeveloper.Rows[i].FindControl("lnkStatus") as Label); LinkButton lnkStatus = (GrdContentDeveloper.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 { // BindddlUser(DtConDev); GrdContentDeveloper.DataSource = null; GrdContentDeveloper.DataBind(); } }
DataView Dv; //For sorting 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 ConDevInd = MasterAcc.SelectedIndex; int ConDevIndex = Convert.ToInt16(Session["SrNo"]); MasterAcc.SelectedIndex = ConDevIndex - 1; // To select loginuser id and login username Login objConDev = new Login(); objConDev.Start(); UserName = objConDev.LogedInUser; LoginUser = objConDev.LoginUser; Ret = objConDev.Ret; if (!Page.IsPostBack) { IsActive = true; // To sort defaulty by Ascending order ViewState["Sort"] = "ASC"; // To fetch Content Developer details having active status DataTable DtConDev = ConDevActiveDetails(IsActive); ViewState["DtConDev"] = DtConDev; if (DtConDev.Rows.Count > 0) { BindConDev(DtConDev); } else { GrdContentDeveloper.DataSource = null; GrdContentDeveloper.DataBind(); } } }