This is a migrated thread and some comments may be shown as answers.

Confirmation Ok-Cancel message in Grid

2 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Phani Musale
Top achievements
Rank 1
Phani Musale asked on 19 Mar 2010, 11:46 AM
Hi,

I want to provide  a confirmation dialog box in an edit mode, when the "update" on a row of a grid is clicked ?

Can anybody suggest ways of doing the same?

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 19 Mar 2010, 12:49 PM

Hello Phani,

By using following code, you can add confirm for Update button click.

C#:

 
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
        {  
            GridEditableItem editItem = (GridEditableItem)e.Item;  
            LinkButton lnkButton = (LinkButton)editItem.FindControl("UpdateButton");  
            lnkButton.Attributes.Add("onclick""return showConfirm();");  
        }         
    } 

Client Side:

 
<script type="text/javascript">  
    function showConfirm() {  
        return (confirm('Are you sure...?'));  
    }  
</script> 

Regards,

Shinu.

0
Phani Musale
Top achievements
Rank 1
answered on 19 Mar 2010, 02:57 PM
Brilliant.
Thanks Shinu.
Tags
Grid
Asked by
Phani Musale
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Phani Musale
Top achievements
Rank 1
Share this question
or