zoukankan      html  css  js  c++  java
  • asp.net gridview 控件如何根据一列内容显示另一列的内容

    1.前台控件代码

    通过开庭时间去显示不同的状态

    //后台绑定和不绑定的却别在于DataField属性
    <asp:BoundField  HeaderText="状态" SortExpression="State" >
                              <HeaderStyle Width="50px" />
                            </asp:BoundField>
    
    <asp:BoundField DataField="KTRQ" HeaderText="开庭日期" SortExpression="KTRQ" >
                              <HeaderStyle Width="50px" />
                            </asp:BoundField>

     2.在GridView1_RowDataBound方法中判断状态

     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            GridViewRow gvr = e.Row;
            for (int i = 2; i < gvr.Cells.Count; i++)
            {
                try
                {
    //0,1,2换成对应时间
    if (gvr.Cells[4].Text.Trim() == "0") { gvr.Cells[9].Text = "未开庭"; } if (gvr.Cells[4].Text.Trim() == "1") { gvr.Cells[9].Text = "已开庭"; } if (gvr.Cells[4].Text.Trim() == "2") { gvr.Cells[9].Text = "已结庭"; } if (gvr.Cells[4].Text.Trim() == "") { gvr.Cells[9].Text = ""; } } catch (Exception ex) { continue; } }
  • 相关阅读:
    单链队列
    栈的顺序存储表示
    顺序队列
    串的定长顺序存储表示
    串的堆分配存储
    双向循环链表
    单循环链表的表示和实现
    串的块链存储表示
    线性表的顺序表示和实现
    线性表的单链表表示和实现
  • 原文地址:https://www.cnblogs.com/wdd812674802/p/10407749.html
Copyright © 2011-2022 走看看