On my page I am trying to put up a button inside an asp:ListView
<asp:Button runat="server" OnClick="button_Click" Text='<%#Eval("Name") %>' />
My bound collection has 2 items so listview should generate a table with two rows
<table>
<tr><td>//button goes here</td></tr>
<tr><td>//button goes here</td></tr>
</table>
However when I check the source of the page that was sent from the server, it looks like it cuts off right as it’s about to generate the button (in fact the rest of the entire page doesn’t get generated):
<table>
<tr><td>
I’m running this out of Visual Studio 2010, .NET 4.0 – is it possible that the built-in server is unable to recognize the tag? Has anyone else experienced something like this? I don’t have a proper IIS set up yet so I can’t check how it’d be rendered there.
So being very new to ASP.NET, I have forgotten to place my page between the
<form runat="server"></form>tags. I’ve now added those in and button gets rendered.The odd part now is that the
<asp:Repeater>and<asp:ListView>did work but the only explanation I can think of is that these controls probably have the<form>tag embedded…Feel free to close question or delete it altogether (it’s a little embarrassing now, actually!).