Пример #1
0
    protected void grdAttachment_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[0].Visible = false;
        e.Row.Cells[1].Visible = false;
        e.Row.Cells[2].Visible = false;
        e.Row.Cells[3].Visible = false;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((LinkButton)e.Row.Cells[6].Controls[0]).Attributes.Add("onclick", "return confirm('Do you really want to delete?');");

            ATTGeneralTippaniAttachment attach = e.Row.DataItem as ATTGeneralTippaniAttachment;
            System.Drawing.Color        c      = BLLGeneralTippani.GetActionColor(attach.Action);
            e.Row.ForeColor = c;

            if (attach.Action == "D")
            {
                ((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Undo";
            }
            else if (attach.Action == "N" || attach.Action == "A" || attach.Action == "E")
            {
                ((LinkButton)e.Row.Cells[6].Controls[0]).Text = "Delete";
            }
        }
    }
    protected void grdPostList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        e.Row.Cells[0].Visible  = false;
        e.Row.Cells[2].Visible  = false;
        e.Row.Cells[3].Visible  = false;
        e.Row.Cells[4].Visible  = false;
        e.Row.Cells[5].Visible  = false;
        e.Row.Cells[14].Visible = false;
        e.Row.Cells[15].Visible = false; //select command

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ATTGeneralTippaniSummary summary = e.Row.DataItem as ATTGeneralTippaniSummary;
            System.Drawing.Color     c       = BLLGeneralTippani.GetActionColor(summary.Action);
            e.Row.ForeColor = c;

            if (summary.Action == "D")
            {
                ((LinkButton)e.Row.Cells[16].Controls[0]).Text = "Undo";
            }
            else if (summary.Action == "N" || summary.Action == "A" || summary.Action == "E")
            {
                ((LinkButton)e.Row.Cells[16].Controls[0]).Text = "Delete";
            }
        }
    }
    protected void grdVisiterDetail_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ATTGeneralTippaniSummary summary = e.Row.DataItem as ATTGeneralTippaniSummary;
            System.Drawing.Color     c       = BLLGeneralTippani.GetActionColor(summary.Action);
            e.Row.ForeColor = c;

            if (summary.Action == "D")
            {
                ((LinkButton)e.Row.Cells[9].Controls[0]).Text = "Undo";
            }
            else if (summary.Action == "N" || summary.Action == "A" || summary.Action == "E")
            {
                ((LinkButton)e.Row.Cells[9].Controls[0]).Text = "Delete";
            }
        }
    }