Moving Through Gridview

jlcruzAME

Member
Joined
Oct 18, 2012
Messages
21
Programming Experience
1-3
Currently I have a page that pulls data out of a table into a gridview. One of the columns is a check box where they mark entries for completion. When they've marked all the entries they need, they click on a submit button that, at the moment, processes all the checked entries at once. Is there a way to move through the Gridview one entry at a time and check the info in each entry? The parameters for updating these entries will be determined by another column in the table so I'll need to check each entry if possible. Is there some way to do this in the code that would allow me to run through the gridview like a recordset? I apologize if this is something easy to do, I'm quite new to ASP.NET and VB.NET as I usually work with VBA.
 
Hi,

Try this:-

VB.NET:
For Each DGVR As DataGridViewRow In DataGridView1.Rows
  'you can use  the cells property here to get individual cells in each row
  MsgBox(DGVR.Cells(0))
Next
Cheers,

Ian
 
I get the red lines on DataGridViewRow and DataGridView1. Is there other code I need to set up prior to this? As I said, I am rather new to VB.NET and ASP.NET.
 
Ah,

My apologies, you are using the ASP GridView control and I made the assuption that you were using the VB DataGridView control since you posted the the VB forum. I have not used the ASP GridView control before so please ignore my post but if you have a quick look around the net I am sure you will find that there will be a similar method that can be applied but just using different class types. If you cannot find an answer by tomorrow I will have another look and come back to you if I find an answer.

Cheers and sorry for the confusion.

Ian
 
Back
Top