zoukankan      html  css  js  c++  java
  • gridview行绑定的简单运用

     1         /// <summary>
     2         /// GridView行绑定
     3         /// </summary>
     4         /// <param name="sender"></param>
     5         /// <param name="e"></param>
     6         protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
     7         {
     8             if (e.Row.RowType == DataControlRowType.DataRow)
     9             {
    10                 if (objlist != null)
    11                 {
    12 
    13                 }
    14                 GridViewCommon.SetDeleteMsg(e);
    15                 GridViewCommon.SetEditUrl(e, GridView1, 0);//默认第一列为查看,若第一列visable=false则不显示
    16                 GridViewCommon.SetRowDataBound(sender, e, "编辑,删除");
    17                 GridViewCommon.SetMouseColor(e);
    18                 //e.Row.RowIndex;
    19                 e.Row.Cells[1].Text = "<a href=\"#\" onclick=\"WinOpenEdit('" + GridView1.DataKeys[e.Row.RowIndex].Value.ToString() + "','view')\">" + e.Row.Cells[1].Text + "</a>";
    20                 if (!string.IsNullOrEmpty(objlist.Rows[e.Row.RowIndex]["weeksummary"].ToString().Trim()))
    21                 {
    22                     e.Row.Cells[1].Text += "</br > <span style='color:Red'>本周总结:</span>" + objlist.Rows[e.Row.RowIndex]["weeksummary"].ToString();
    23                 }
    24                 if (!string.IsNullOrEmpty(objlist.Rows[e.Row.RowIndex]["weekplan"].ToString().Trim()))
    25                 {
    26                     e.Row.Cells[1].Text += "</br > <span style='color:Red'>本周计划:</span>" + objlist.Rows[e.Row.RowIndex]["weekplan"].ToString();
    27                 }
    28                 if (!string.IsNullOrEmpty(objlist.Rows[e.Row.RowIndex]["monthsummary"].ToString().Trim()))
    29                 {
    30                     e.Row.Cells[1].Text += "</br > <span style='color:Red'>本月总结:</span>" + objlist.Rows[e.Row.RowIndex]["monthsummary"].ToString();
    31                 }
    32                 if (!string.IsNullOrEmpty(objlist.Rows[e.Row.RowIndex]["monthplan"].ToString().Trim()))
    33                 {
    34                     e.Row.Cells[1].Text += "</br > <span style='color:Red'>本月计划:</span>" + objlist.Rows[e.Row.RowIndex]["monthplan"].ToString();
    35                 }
    36             }
    37         }

  • 相关阅读:
    读写ini文件
    身份证号码验证正则表达式
    使用SubSonic生成数据访问层步骤
    MonoRail&ActiveRecord开发中的注意事项
    C#实现邮件发送的功能
    建立ASP.NET服务器控件
    操作身份验证
    看了几天C#了...人开始变得有点急躁
    关于正则表达式
    如何在多台电脑上同时安装Windows
  • 原文地址:https://www.cnblogs.com/suwh/p/2551933.html
Copyright © 2011-2022 走看看