Web Technologies

BLOG for Web Technologies

Freewares, Free E-Books Download, SEO, Tips, Tricks, Tweaks, Latest News, .Net, PHP, ASP, ASP.Net, CSP, MS SQL Server, MySQL, Database
earnptr.com
Tuesday, December 9, 2008
How to add alert Javascript coding for Gridview?
Sometimes we need to confirm from the client side, whether to proceed for deletion operation or not? We can use this code snippet to add that alert box to the user.

Declarations:
'none

Code:
Protected Sub gvcat_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvcat.RowDataBound

' This block of code is used to confirm the deletion of current record.
If e.Row.RowType = DataControlRowType.DataRow Then
Dim l As Object
' e.Row.Controls(4) is Delete button.
l = e.Row.Controls(4)
l.Attributes.Add("onclick", "javascript:return confirm('Are you sure to delete?')")
End If
End Sub


Labels: ,

posted by WebTeks @ 10:51 PM  
0 Comments:
Post a Comment
<< Home
 
Previous Post
Archives
Links
Template by

Free Blogger Templates

BLOGGER

Subscribe in NewsGator Online Subscribe in Rojo Add to Google Add to netvibes Subscribe in Bloglines Web Developement Blogs - BlogCatalog Blog Directory Blogarama - The Blog Directory Blog Directory & Search engine Computers Blogs - Blog Top Sites Top Computers blogs