开发者

ASP.NET Repeater will not show data

开发者 https://www.devze.com 2023-03-16 21:16 出处:网络
I have an ASP.Net Repeater I want to use to show From and Text from a dataset and I want to add it programmically.I have all the data in a dataset and can use that and I have verified the correct numb

I have an ASP.Net Repeater I want to use to show From and Text from a dataset and I want to add it programmically. I have all the data in a dataset and can use that and I have verified the correct number for datarows when it loads so the data is their it is just not showing. What have I missed?.

Dim data As New Data
Dim ds As New DataSet
ds = data.LOADALL()
Dim drMsg() As DataRow = ds.Tables("MESSAGESYSTEM").Select("TOID='101'")
repeatMessages.DatagSource = drMsg

Now on the html side I have:

<asp:Repeater ID="repeatMessages" runat="server" >
    <HeaderTemplate>
              <table>
              <tr>
                 <th>From</th>
                 <th>Sublect</th>
              </tr>
          </HeaderTemplate>
          <ItemTemplate>
          <tr>
              <td bgcolor="#CCFFCC">
                    <asp:Label runat="server" ID="Label1" text='<%# Eval("FROMID") %>' />
              </td>
              <td bgcolor="#CCFFCC">
                  <asp:Label runat="server" ID="Label2" text='<%# Eval("MESSAGETEXT") %开发者_如何学Go>' />
              </td>
          </tr>
          </ItemTemplate>
          <FooterTemplate>
              </table>
          </FooterTemplate>
    </asp:Repeater>

How can I fix this code to show the data in the Message table?


Try calling repeatMessages.DataBind(). All you are doing is assigning the source but you haven't told the program to do something with the data.

0

精彩评论

暂无评论...
验证码 换一张
取 消