2013-11-04 9 views
5

Voglio che l'eventodi GridView non esegua un completo postback su un clic ErrorLinkButton. Così ho avvolto il controllo in un pannello di aggiornamento e aggiunto un AsyncPostBackTrigger per OnRowCommand:Trigger UpdatePanel: impossibile trovare un evento denominato "OnRowCommand"

<asp:GridView ID="DataSourceMappingGridView" runat="server" DataKeyNames="Index" ClientIDMode="Static" OnRowCommand="DataSourceMappingGridView_RowCommand" OnRowDataBound="DataSourceMappingGridView_RowDataBound"> 
<Columns> 
    <asp:TemplateField> 
     <ItemTemplate> 
      <asp:UpdatePanel ID="ErrorUpdatePanel" runat="server"> 
       <Triggers> 
        <asp:AsyncPostBackTrigger ControlID="DataSourceMappingGridView" EventName="OnRowCommand" /> 
       </Triggers> 
       <ContentTemplate> 
        <asp:LinkButton ID="ErrorTextLinkButton" CommandName="Errors" CommandArgument='<%#Bind("Index") %>' runat="server" Text='View Errors' /> 
       </ContentTemplate> 
      </asp:UpdatePanel> 
     </ItemTemplate> 
    </asp:TemplateField> 
</Columns> 
</asp:GridView> 

Ma ottengo il seguente errore:

Could not find an event named 'OnRowCommand' on associated control 'DataSourceMappingGridView' for the trigger in UpdatePanel 'ErrorUpdatePanel'.

risposta

11

L'evento si chiama RowCommand non OnRowCommand

Sostituire

EventName="OnRowCommand" 

con

EventName="RowCommand" 

e dovrebbe funzionare

Problemi correlati