I need to use a Repeater to display data from an SQL Data Source object, but it's not working. I tried the same with GridView and it worked fine, so everything is working except for the Repeater thing.
The result I get is a bunch of "System.Data.DataRowView System.Data.DataRowView..."
C# code:
protected void Page_Load(object sender, EventArgs e)
{
repeater.DataSource = SqlDataSource1;
repeater.DataBind();
}
ASP:
<asp:Repeater ID="repeater" runat="server">
<ItemTemplate>
<%# Container.DataItem %>
</ItemTemplate>
</asp:Repeater>
Thanks in advance!
You need to add in your itemtemplate tag with Eval("YourColumnName") or Databinder.Eval().
<ItemTemplate>
<%# Eval("CodFlowElement")%>
</ItemTemplate>
or you can use like this
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem,"CodFlowElement")%>
</ItemTemplate>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.