Asp Dot Net Notes for Web Masters RSS 2.0

# Sunday, May 17, 2009
To add a confirmation to the automatically generated delete button you can add an event handler to the ItemDataBund event of the grid. The code below adds a confirmation message that appears in a dialog box. The message also displays the row data to help the user know what he is deleting.
    public void PriceType_RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            //Get the Data we want to show to the User
            GridDataItem dataItem = e.Item as GridDataItem;
            string DataItem = dataItem["PriceType"].Text;

            //Add the message to the Button
            LinkButton button = e.Item.FindControl("AutoGeneratedDeleteButton") as LinkButton;
            button.Attributes["onclick"] = "return confirm('Are you sure you want to delete " +
            DataItem + "?')";
        }
    }

Sunday, May 17, 2009 3:27:45 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Controls
All comments require the approval of the site owner before being displayed.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Archive
<February 2012>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
I do I.T. Ltd.
Sign In
Statistics
Total Posts: 27
This Year: 0
This Month: 0
This Week: 0
Comments: 22
All Content © 2012, I do I.T. Ltd.