开发者

How to get a confirm popup in asp.net

Inside the grid I have a delete button inside a grid and have a code behind to perform the delete.

<asp:TemplateField HeaderText="Edit Controls" ItemStyle-Width="15%">
 <ItemTemplate>
   <asp:LinkButton ID="Lnk_Delete" ToolTip="Delete Message" 
   CommandArgument='<%#Eval(开发者_JAVA技巧"MsgID") %>' CommandName="Delete" runat="server"> 
   <img id="Img1" src="Styles/Images/Delete.jpg" runat="server"  /></asp:LinkButton>
 </ItemTemplate>
</asp:TemplateField> 

 protected void Grid_Messagetable_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }

Everything works fine how to get a confirm pop up before the delete is performed.


You could use the OnClientClick property as shown in the following article:

<asp:LinkButton 
    ID="Lnk_Delete" 
    runat="server"
    ToolTip="Delete Message" 
    CommandArgument='<%#Eval("MsgID") %>' 
    CommandName="Delete" 
    OnClientClick="return confirm('Are you sure you want to delete this record?');"> 
    <img id="Img1" src="Styles/Images/Delete.jpg" runat="server"  />
</asp:LinkButton>


Try adding

OnClientClick="return confirm('Do you want Delete?');"


onClientClick="return confirm('Are you sure you want to delete?')";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜