Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting which radiobuttons were changed

Status
Not open for further replies.

RebLazer

Programmer
Jun 7, 2002
438
US
I have a datagrid that contains a template column that houses one pair of radiobuttons ("Yes" and "No") per row. I also have a submit button at the bottom of the page.

The idea is that the initial value ("Yes" or "No") is populated from the database. Subsequently the user may be change the radiobuttons' values, then click the submit button to update the database.

How can I detect which radiobuttons were changed in order to only update the database with the values that were changed?


Thanks!
Lazer[pipe]
 
Paul(link9) pointed me at this yesterday and I think this may have exactly what you are looking for.. great article on the datagrid to boot...

Part 10 I believe is the section that you will want to focus on for your radio button issues.
 
Small,

I looked at that article (actually, it's part 11) which pointed me to this which does exactly what I want. So I downloaded the code, but after reading through the C# code, I can't seem to find what makes it tick - i.e. how it works. And I am just looking for a small chunk of VB.net code that will do that - not a whole big solution...

Any other places to look?

Thanks,
Lazer
 
You can loop through your entire dataset by iterating over the items collection:

for i = 0 to datagrid.items.count - 1
if ctype(datagrid.items(i).findControl("controlName"),radiobutton).checked then
'it's checked
else
'it's not checked
end if
next

This is somewhat inneficient, as it will iterate your entire datagrid, rather than how you typically access a single item in the context of a commandEvent handler, but if this is what you need, then that's how you do it.

-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
[red]Thank you very much, Paul!!! You saved the day again!

[/color]

Lazer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top