I have a datalist that displays images that I want to use as buttons, so I used the image button. But when I click the image, I get an error before it even gets to the if(e.CommandName == "imgButton") line. All I get is: 'System.Web.HttpUnhandledException' was thrown, I'm at a total loss. What am I doing wrong? Thanks
<asp:DataList ID="dlImages" runat="server" RepeatDirection="Horizontal" RepeatColumns="3" OnItemCommand="dlImages_ItemCommand">
<ItemTemplate>
<asp:ImageButton ID="imgButton" runat="server" CommandName="imgButton"
CommandArugment='<%# Eval("id")%>'
ImageUrl='<%# Eval("url")%>' Style="max-width: 200px" />
</ItemTemplate>
</asp:DataList>
protected void dlImages_ItemCommand(object source, DataListCommandEventArgs e)
{
if(e.CommandName == "imgButton")
{
string taid = e.CommandArgument.ToString();
ShowModel(Toolkit.ToInt32(taid, 0));
}
}