.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Selecting a ROW in the DataGrid in ASP.NET

Posted By:Athira Sreejith       Posted Date: February 22, 2009    Points: 5    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  
 

How we want to select a row in the GridView in your ASP.Net application.

Dim con As SqlConnection

Dim dgi As DataGridItem

Dim c As CheckBox

For Each dgi In DataGrid1.Items

c = CType(dgi.Cells(0).FindControl("chk1"), CheckBox)

If c.Checked = True Then

con = New SqlConnection(ConfigurationSettings.AppSettings("Constr"))

Sqlstr = "Delete from tbl_campaignmaster where CampaignId= '" & dgi.Cells(1).Text.Trim() & "'"

Dim cmd As New SqlCommand(Sqlstr, con)

con.Open()

cmd.ExecuteNonQuery()

con.Close()

End If

Next


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend