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
Archive
<May 2009>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
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.