/// <summary>
 /// To bind vendor details in gridview
 /// </summary>
 /// <param name="DtVen"></param>
 private void BindVen(DataTable DtVen)
 {
     if (DtVen.Rows.Count > 0)
     {
         GrdVendor.DataSource = DtVen;
         GrdVendor.DataBind();
         for (int i = 0; i < GrdVendor.Rows.Count; i++)
         {
             Label      lblVenUser = (GrdVendor.Rows[i].FindControl("lblUser") as Label);
             Label      lblStatus  = (GrdVendor.Rows[i].FindControl("lnkStatus") as Label);
             LinkButton lnkStatus  = (GrdVendor.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
     {
         GrdVendor.DataSource = null;
         GrdVendor.DataBind();
     }
 }
    DataView DvFilter;                 // For filter 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 objVendor = new Login();

        objVendor.Start();
        Useraname = objVendor.LogedInUser;
        LoginUser = objVendor.LoginUser;
        Ret       = objVendor.Ret;
        if (!Page.IsPostBack)
        {
            IsActive = true;
            // To sort defaulty by Ascending order
            ViewState["Sort"] = "ASC";
            // To fetch Group details having active status
            DataTable DtVen = VenActiveDetails(IsActive);
            ViewState["DtVen"] = DtVen;
            if (DtVen.Rows.Count > 0)
            {
                BindVen(DtVen);
            }
            else
            {
                GrdVendor.DataSource = null;
                GrdVendor.DataBind();
            }
        }
    }