C# 为什么Updatepanel中存在的GridView中的LinkButton没有触发OnClientClick事件?

C# 为什么Updatepanel中存在的GridView中的LinkButton没有触发OnClientClick事件?,c#,asp.net,gridview,updatepanel,asplinkbutton,C#,Asp.net,Gridview,Updatepanel,Asplinkbutton,我将GridView放在Updatepanel中,在那里我定义了几个带有一个LinkButton的列。但对于该LinkButtonOnClientClick事件未触发。相反,它正在进行回发。 代码如下: <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:GridView ID="gvUnmappedIC


我将GridView放在Updatepanel中,在那里我定义了几个带有一个LinkButton的列。但对于该LinkButtonOnClientClick事件未触发。相反,它正在进行回发。
代码如下:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
   <ContentTemplate>
      <asp:GridView ID="gvUnmappedICD" runat="server" EmptyDataText="No Records are added yet."
             OnRowCommand="gvUnmappedICD_RowCommand" OnRowDataBound="gvUnmappedICD_RowDataBound">
          <Columns>
             <asp:TemplateField HeaderText="Action">
                 <ItemTemplate>
                    <asp:LinkButton ID="lnkRemove" runat="server" CommandArgument='<%#Eval("KEYWORD") %>' CommandName="remove" ClientIDMode="AutoID"
                        OnDataBinding="lnkRemove_DataBinding" OnClientClick='return confirm("Are you sure you want to Delete this?");' ToolTip="Click to Remove this record." Text="Remove" />
                 </ItemTemplate>
          </Columns>
      </asp:GridView>
   </ContentTemplate>
</asp:UpdatePanel>

请任何人帮助我解决这个问题。

使用PostBackTrigger

<asp:ScriptManager ID="scriptManager" runat="server">
        <asp:UpdatePanel ID="updatePanel" runat="server">
            <asp:GridView ID="gvUnmappedICD" runat="server" EmptyDataText="No Records are added yet."
         OnRowCommand="gvUnmappedICD_RowCommand" OnRowDataBound="gvUnmappedICD_RowDataBound">
      <Columns>
         <asp:TemplateField HeaderText="Action">
             <ItemTemplate>
                <asp:LinkButton ID="lnkRemove" runat="server" CommandArgument='<%#Eval("KEYWORD") %>' CommandName="remove" ClientIDMode="AutoID"
                    OnDataBinding="lnkRemove_DataBinding" OnClientClick='return confirm("Are you sure you want to Delete this?");' ToolTip="Click to Remove this record." Text="Remove" />
             </ItemTemplate>
      </Columns>
  </asp:GridView>
            <Triggers>
                <asp:PostBackTrigger ControlID="lnkRemove" />
            </Triggers>
       </asp:UpdatePanel>

请使用链接按钮的
OnClientClick

 OnClientClick='return confirm("Are you sure you want to Delete this?");return false;'

您好@vakeel,您的回答将导致以下错误<代码>在UpdatePanel“UpdatePanel1”中找不到触发器ID为“lnkRemove”的控件。
 OnClientClick='return confirm("Are you sure you want to Delete this?");return false;'