This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Wednesday, November 19, 2008

How to add alert Javascript coding for Gridview using asp.net

How to add alert Javascript coding for Gridview using asp.net

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

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger