R
Rob Rutherford
I have a Repeater on an ASP.NET page. If I click a Button in the Repeater,
the Repeater's ItemCommand event fails to fire. If anyone can explain why
it doesn't fire I'd be grateful. Here's the code.
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load
Dim cnn As SqlConnection
Dim cmd As SqlCommand
cnn = New SqlConnection("server=(local);trusted_connection=yes;database=pubs")
cmd = New SqlCommand("select au_lname from authors",cnn)
cnn.Open()
rptr.DataSource = cmd.ExecuteReader()
rptr.DataBind()
cnn.Close()
lbl.Text += "Page_Load "
End Sub
Sub ItemCommand(s As Object, e As RepeaterCommandEventArgs)
lbl.Text += "ItemCommand "
End Sub
</script>
<html>
<body>
<form runat="Server">
<asp:Label id="lbl" runat="server" EnableViewState="false"/>
<asp:Repeater id="rptr" runat="Server" OnItemCommand="ItemCommand">
<HeaderTemplate>
<asp:Button runat="server"/>
</HeaderTemplate>
</asp:Repeater>
</form>
</body>
</html>
the Repeater's ItemCommand event fails to fire. If anyone can explain why
it doesn't fire I'd be grateful. Here's the code.
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load
Dim cnn As SqlConnection
Dim cmd As SqlCommand
cnn = New SqlConnection("server=(local);trusted_connection=yes;database=pubs")
cmd = New SqlCommand("select au_lname from authors",cnn)
cnn.Open()
rptr.DataSource = cmd.ExecuteReader()
rptr.DataBind()
cnn.Close()
lbl.Text += "Page_Load "
End Sub
Sub ItemCommand(s As Object, e As RepeaterCommandEventArgs)
lbl.Text += "ItemCommand "
End Sub
</script>
<html>
<body>
<form runat="Server">
<asp:Label id="lbl" runat="server" EnableViewState="false"/>
<asp:Repeater id="rptr" runat="Server" OnItemCommand="ItemCommand">
<HeaderTemplate>
<asp:Button runat="server"/>
</HeaderTemplate>
</asp:Repeater>
</form>
</body>
</html>