Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 How to Loop through GridView Rows? GridViewRow
Posted by Moderator1 on  6/17/2008 8:49:40 PM 45845 Views
Use GridViewRow class to loop through or navigate the GridView rows from outsite the GridView control's event.

For example, you need to navigate all the rows in a gridview control and find a child control placed inside it. The sample code below helps you to find a Checkbox placed inside a GridView control.

foreach (GridViewRow gvrow in GridView1.Rows)
CheckBox CheckBox1 = (CheckBox)gvrow.FindControl("CheckBox1");
if (CheckBox1.Checked)
//Do your operations here.

Post New Tips/Tricks View all Tips/Tricks

Featured Resources:
Everything You Know About CSS Is Wrong! - Free 37 Page Preview!
For web designers and developers who want to ensure they're using the very latest, best-practice CSS techniques.
When Good HTML Goes Bad: How You Can Protect Your Web Applications
This webinar highlights how modern attacks target the web browser – and the best practices to safeguard your web applications against these risks.
100% Free Subscription until Stock lost.View complete list.
Sponsored by