コード例 #1
0
    DataView DvProLead;                    // For Program Lead 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 objProLead = new Login();

        objProLead.Start();
        UserName  = objProLead.LogedInUser;
        LoginUser = objProLead.LoginUser;
        Ret       = objProLead.Ret;
        if (!Page.IsPostBack)
        {
            IsActive = true;
            // To sort defaulty by Ascending order
            ViewState["Sort"] = "ASC";
            // To fetch Program Lead details having active status
            DataTable DtProLead = ProLeadActiveDetails(IsActive);
            ViewState["DtProLead"] = DtProLead;
            BindProLead(DtProLead);
            if (DtProLead.Rows.Count > 0)
            {
                BindProLead(DtProLead);
            }
            else
            {
                GrdProgramLead.DataSource = null;
                GrdProgramLead.DataBind();
            }
        }
    }
コード例 #2
0
 /// <summary>
 /// To bind Program Lead details in grid
 /// </summary>
 /// <param name="DtProLead"></param>
 private void BindProLead(DataTable DtProLead)
 {
     if (DtProLead.Rows.Count > 0)
     {
         GrdProgramLead.DataSource = DtProLead;
         GrdProgramLead.DataBind();
         for (int i = 0; i < GrdProgramLead.Rows.Count; i++)
         {
             Label      lblProLeadUser = (GrdProgramLead.Rows[i].FindControl("lblUser") as Label);
             Label      lblStatus      = (GrdProgramLead.Rows[i].FindControl("lnkStatus") as Label);
             LinkButton lnkStatus      = (GrdProgramLead.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
     {
         GrdProgramLead.DataSource = null;
         GrdProgramLead.DataBind();
     }
 }