Пример #1
0
    protected void gvPersonMessageInfo_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
            Message msg = (Message)gvPersonMessageInfo.DataKeys[e.Row.RowIndex].Value;

            for (int i = 1; i < e.Row.Cells.Count; i++)
            {
                e.Row.Cells[i].Attributes.Add("onclick", "ScanSendMessageDetail('" + msg.MessageId + "')");
            }
            string what = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Message.Type.MessageTypeName"));

            if (what.Equals("紧急消息"))
            {
                e.Row.Cells[4].Style.Add("color", "red");
            }
            MessageToUser toUser = MessageToUserManager.GetMessageToUserByMessageId(msg.MessageId);
            if (toUser.IfRead == 0)
            {
                Image img = new Image();
                img.ImageUrl = "../../Images/new.gif";
                e.Row.Cells[2].Controls.Add(img);
            }
        }
    }
Пример #2
0
 /// <summary>
 /// 光棒效果
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void gvMessage_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
         e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
         HyperLink     hl   = e.Row.FindControl("hlSendObject") as HyperLink;
         MessageToUser item = MessageToUserManager.GetMessageToUserByMessageId(Convert.ToInt32(hl.Text.Trim()));
         //给消息类型加色
         string what = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Type.MessageTypeName"));
         if (what.Equals("紧急消息"))
         {
             e.Row.Cells[1].Style.Add("color", "red");
         }
         if (item.ToUser == null)
         {
             hl.Text = "所有用户";
         }
         else
         {
             hl.NavigateUrl = "javascript:ScanReceiveUsers(" + hl.Text.Trim() + ")";
             hl.Text        = "查看发送用户名";
         }
         int ifPublish = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "IfPublish"));
         if (ifPublish == 1)
         {
             ImageButton imgBtnUpdate = e.Row.FindControl("imgBtnUpdate") as ImageButton;
             //e.Row.Cells[8].Style.Add("background-color", "#999999");
             imgBtnUpdate.BackColor = Color.Gray;
         }
     }
 }