Repeater - ItemCommand and EnableViewState

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top