单击数据师中的图像按钮时会丢弃错误
我有一个数据库,显示要用作按钮的图像,因此我使用了图像按钮。但是,当我单击图像时,我会发现错误,甚至甚至到达if(e.commandname ==“ imgbutton”)行之前。我得到的是:“ system.web.httpunhandledexception”被投掷了,我总损失了。我在做什么错? 谢谢
<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));
}
}
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));
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我需要做的就是不要在寄回上绑定我的数据师。目前,此页面有些问题。就像我需要3D眼镜一样阅读。
All I needed to do was to not bind my datalist on postback. And currently, something is very wrong with this page. Like I need 3D glasses to read it.