mardi 10 octobre 2017

Pull a value from a column when a checkbox (in another column) is check

Intermediate programmer here using Visual Studio 2010 and doing all in VB not C#.

Have a 15-column GridView1. Auto-Select takes up the [0] column. Column [1] have a JobNumber value which is different for each row. Column [14] has a template field with a single CheckBox1 per row.

I need to get the value from Column [1] if Column [14] is checked. I can get the occurrence of the checkbox using this code:

For Each row As GridViewRow In GridView1.Rows Dim result As Boolean = DirectCast(row.FindControl("CheckBox1"), CheckBox).Checked

This code does work to find which row has a checked box. The problem, which I haven't found an answer to is as the code runs and the rows are found, how do I get the value displayed in Column [1} for each of the rows found to have a checked box?

Its probably been answered prior to this question of mine but I may have terminology wrong and am just asking the wrong question.

Thanks all!




Aucun commentaire:

Enregistrer un commentaire