• 数据控件绑定技巧


    代码
    <asp:DataList ID="Mylist" runat="server" HorizontalAlign="center" Width="98%">
    <HeaderTemplate>
    <table id="t1" border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td width="3">
    </td>
    <td width="30" align="center">
    <%=xmldoc.SelectSingleNode("//UI/ID").InnerText %>
    </td>
    <td>
    <%=xmldoc.SelectSingleNode("//UI/OUTFIT_NO").InnerText %>
    </td>
    <td width="80">
    <%=xmldoc.SelectSingleNode("//UI/STATUS_NO").InnerText%>
    </td>
    <td width="100">
    <%=xmldoc.SelectSingleNode("//UI/CHECK_STATUS").InnerText %>
    </td>
    <td width="80">
    <%=xmldoc.SelectSingleNode("//UI/USER_NAME").InnerText %>
    </td>
    <td width="100">
    <%=xmldoc.SelectSingleNode("//UI/CHECK_DATE").InnerText %>
    </td>
    <td width="100">
    <%=xmldoc.SelectSingleNode("//UI/NEXT_DATE").InnerText %>
    </td>
    <td width="3">
    </td>
    </tr>
    </table>
    </HeaderTemplate>
    <ItemTemplate>
    <table id="t2" border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td width="3">
    </td>
    <td width="30" align="center">
    <%# (Container.ItemIndex + 1).ToString("00") + "." %>
    </td>
    <td>
    <%#DataBinder.Eval(Container.DataItem, "OUTFIT_NO")%>
    </td>
    <td width="80">
    <%# GetState(Container)%>
    </td>
    <td width="100">
    <%#DataBinder.Eval(Container.DataItem,"CHECK_STATUS") %>
    </td>
    <td width="80">
    <%#DataBinder.Eval(Container.DataItem,"USER_NAME") %>
    </td>
    <td width="100">
    <%#DataBinder.Eval(Container.DataItem,"CHECK_DATE","{0:yyyy-MM-dd}") %>
    </td>
    <td width="100">
    <%#DataBinder.Eval(Container.DataItem,"NEXT_DATE","{0:yyyy-MM-dd}") %>
    </td>
    <td width="3">
    </td>
    </tr>
    </table>
    </ItemTemplate>
    </asp:DataList>
    代码
    public string GetState(DataListItem data)
    {
    string checkState = "";
    string nextDate = "";

    DataRowView view
    = (DataRowView)data.DataItem;
    checkState
    = view.Row["CHECK_STATUS"].ToString();
    nextDate
    = view.Row["NEXT_DATE"].ToString();
    if (checkState == "P" && DateTime.Parse(nextDate) > DateTime.Now)
    {
    return "\u53EF\u7528";
    }
    else
    {
    return "\u4E0D\u53EF\u7528";
    }

    }
  • 相关阅读:
    转换进制,十六进制数相加
    一个人的旅行(Dijkstra算法)
    畅通工程续(Dijkstra算法)
    免费书下载
    http://d3js.org/
    React.js model
    jtable更新数据
    java knowledge record
    ActionListener三种实现
    java接口理解(转载)
  • 原文地址:https://www.cnblogs.com/yym/p/1676366.html
Copyright © 2020-2023  润新知