1

ここにasp.netのコードタグコードがあり、ダウンロードアイテムのクリックイベントでコードが必要な画像ボタンがあります。クリックイベントでコーディングしようとしましたが、機能しませんでした

    <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>

これは、同じページの ac# プライベート コード クラスです。

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.
4

2 に答える 2