Example #1
0
        protected void AdviceGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label AlertLabel = (Label)e.Row.FindControl("AlertLabel");
                if (AlertLabel != null)
                {
                    Label NoteLabel = (Label)e.Row.FindControl("NoteLabel");

                    switch (AlertLabel.Text)
                    {
                    case "1":
                        e.Row.CssClass = "alertRow";
                        NoteLabel.Text = "必须回复";
                        break;

                    case "2":
                        Label CreateLabel = (Label)e.Row.FindControl("CreateLabel");


                        if (CreateLabel != null)
                        {
                            DateTime create = Convert.ToDateTime(CreateLabel.Text);
                            int      days   = AdviceHelper.GetWorkingDays(create);
                            if (days >= 3)
                            {
                                e.Row.CssClass = "overdueRow";
                                if (NoteLabel != null)
                                {
                                    NoteLabel.Text = "延期";
                                }
                            }
                            else
                            {
                                e.Row.CssClass = "hastenRow";
                                if (NoteLabel != null)
                                {
                                    NoteLabel.Text = "催办";
                                }
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }