Click here to Skip to main content
15,914,225 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How to show popup for the following code
XML
<asp:CommandField ShowDeleteButton="True"   >
                                <HeaderStyle Width="30px" />
                                </asp:CommandField>
Posted
Updated 18-Feb-14 0:57am
v2

Please try is as below (sample).
XML
<asp:LinkButton ID="lbDelete" runat="server" OnClientClick="return confirm('Are you sure want to delete the Corporate Action?')" CausesValidation="False"
                                           CommandName="Delete" Text="Delete"></asp:LinkButton>


For more info : Popup confirmation

Popup Editing/Adding/Deleting Records with GridView[^]
 
Share this answer
 
Comments
Ni!E$H_WAGH 18-Feb-14 7:54am    
Thanks sir........
Sampath Lokuge 18-Feb-14 8:18am    
Glad to hear that it helped!
If you feel this is the answer,please accept it.B'cos it'll help for others.
You should do that on clientside with javascript.

Therefore you can handle GridView's RowDataBound event to add this to the Delete-Button's OnClientClick:


C#
protected void gvShowQuestionnaires_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        // reference the Delete LinkButton
        LinkButton db = (LinkButton)e.Row.Cells[3].Controls[0];

        db.OnClientClick = "return confirm('Are you certain you want to delete this questionnaire?');";
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900