siri

siri

  • NA
  • 45
  • 28.3k

Data Repeater in ASP.NET

Jan 22 2012 9:54 AM
I did sample example using data repeater in ASP  dot net using vb code ...


as iam not getting data frm my table plz can anyone tell y iam not getting data frm table as it showing only table header.....


as my vb code....

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If cn.State = ConnectionState.Closed Then cn.Open()
sqlquery = "select * from Main_tbl "
cmd = New SqlCommand(sqlquery, cn)
adap = New SqlDataAdapter(cmd)
adap.Fill(dt)

If dt.Rows.Count Then
Repeater1.DataSource = dt
Repeater1.DataBind()
End If

End Sub

****************
<body>
<form id="form1" runat="server">
<asp:Repeater ID="Repeater1" runat="server" >
<HeaderTemplate>
<table>
<tr>
<th>
<asp:Label ID="lblsn" Text="School Number" runat="server"></asp:Label>
</th>
<th>
<asp:Label ID="lblan" Text="Account Number" runat="server"></asp:Label>
</th>
<th>
<asp:Label ID="lblln" runat="server" Text="Last Name"></asp:Label>
</th>
<th>
<asp:Label ID="lblzipcode" runat="server" Text="Zip Code"></asp:Label>
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>

</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

</form>
</body>

</html>




Answers (3)