Having a Radio button one in each column in a Datagrid but belong to the same group?

S

Satish Appasani

Hi:

I want to develop a page which contains a datagrid and a couple of columns
in the grid will have radio buttons. All the radio buttons in a row should
belong to the same group so that when i check one the other is unchecked.

Any clue on this? Thanks in advance

Satish
 
A

Alvin Bruney

You may want to just add the radio button to each cell on the itemcreated
event handler and then set the group property on each button so that they
belong to the same family to give you the behavior you are after.

if (i.itemtype.listit == listitem.alternate or listitem.item)

radiobutton t = new radiobutton();
t.GroupName = "onefamily"
radiobutton tt = new radiobutton();
rr.GroupName = "onefamily"

e.item.cells[2].controls.add(t);
e.item.cells[3].controls.add(t);
and so on and so forth

this is rough code, it will not compile, but the approach is correct
 
N

Nick Hertl

Have you looked into using a TemplateColumn in your DataGrid? This is a
very powerful way to generate neet stuff in custom columns.
You could just set the GroupName to the samething for all the ones you want
to be linked. And then determine which one is selected in your handler
function based on either which row in the table its in or some other data
that you associate with it in the TemplateColumn.
----------------
This posting is provided "AS IS" with no warranties, and
confers no rights.

Please do not send e-mail directly to this alias. This
alias is for newsgroup purposes only.

Thanks
Nick

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top