【发布时间】:2013-06-08 14:31:36
【问题描述】:
这里是asp.net的code标签代码 并且有一个图像按钮,我想要下载项目的点击事件代码 我尝试在点击事件上编写代码,但它不起作用
<asp:ListView runat="server" ID="ListView1" GroupItemCount="1">
<LayoutTemplate>
<div>
<asp:PlaceHolder runat="server" ID="groupPlaceHolder" />
</div>
</LayoutTemplate>
<GroupTemplate>
<div style="clear: both;">
<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
</div>
</GroupTemplate>
<ItemTemplate>
<div style="margin-left: 20px; border: 2px rgba(255, 102, 0, 0.36)
dotted; width: 900px; padding: 10px;">
<video src='<%# "Handler.ashx?id=" + Eval("id") %>'
width="900" height="400" controls="" preload=""></video>
</div>
<div style="width:950px; height:90px;" align="right">
<asp:ImageButton ID="ImageButton1"
ImageUrl="images/download-button.jpg" runat="server" width="230px"/>
</div>
</ItemTemplate>
<GroupSeparatorTemplate>
<div style="clear:both"></div>
</GroupSeparatorTemplate>
<EmptyDataTemplate>
</EmptyDataTemplate>
</asp:ListView>
这是同一页面上的一个 c# 私有代码类
Private void Download(string ID)
{
some code here for download
}
请告诉我如何在图像按钮上编码以下载文件。
错误:
回发或回调参数无效。
Event validation is enabled using
<pages enableEventValidation="true"/> in configuration or
<%@ Page EnableEventValidation="true" %> in a page.
For security purposes, this feature verifies that arguments to
postback or callback events originate from the server
control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to
register the postback or callback data for validation.
【问题讨论】:
-
当您说点击事件不起作用时 - 您的意思是它没有触发?在这种情况下,您是否尝试过 Causesvalidation = "false"?
标签: c# asp.net sql-server listview imagebutton