Link to home
Start Free TrialLog in
Avatar of JohnDesautels
JohnDesautelsFlag for United States of America

asked on

Align RadioButtonList Labels in Header of Datagrid

I am building a survey application.

One of the question types asks the user to rank the answers in order of importance. (See sample below.)

------------------------
Rate the following in order of importance from 1 (least) to 5 (most).

1 2 3 4 5          
o o o o o  Cleanliness
o o o o o  Friendliness of Staff
o o o o o  Appliances Functional
o o o o o  Apartment Ready on Time
o o o o o  Flexible Move-in Schedule
------------------------
I am dynamically creating a RadioButonList in the datagrid based on how many answers there are for the question.

The .DataTextField is set to an empty string so that the numbers are not repeated for each row in the datagrid.

How can I get the header to dynamically build the text field labels AND align them properly over the radio buttons?

It is the alignment that really has e stumped. I suspect that I could create separate columns with radio buttons on the appropriate label for each. That seems like it would greatly complicate the data validation I need to do (there must be one unique selection for each answer).

Thanks.

John
Avatar of sachiek
sachiek
Flag of Singapore image

DataGrid1.Items[0].Parent.Controls[0].Controls[0]  ==> This should return "1"

DataGrid1.Items[1].Parent.Controls[0].Controls[0]  ==> This should return "2"

DataGrid1.Items[2].Parent.Controls[0].Controls[0]  ==> This should return "3"

DataGrid1.Items[3].Parent.Controls[0].Controls[0]  ==> This should return "4"

DataGrid1.Items[4].Parent.Controls[0].Controls[0]  ==> This should return "5"

Hope it helps.
Check out with your code and let me know.


Sachi





Avatar of JohnDesautels

ASKER

Sachi,

Thanks for the idea on how to generate the labels.

My concern is really how to get the datagrid header label for each radio button in the dynamically sized radio button list to line up over the top of each radio button.

Ideally it should look good in multiple browsers.

I may need to resort to having a separate column for each button and use some client side code to make them collectively act like a radio button list (i.e. only one can be selected from the list).

John
ASKER CERTIFIED SOLUTION
Avatar of sachiek
sachiek
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you did'nt get it let me know please.

Sachi
Thanks, Sachi.

I'm out of time for this wek and am out of the office next week.

I will revisit when I return.

John
Sorry for the delay in closing this out.

I did end up with a separate column for each Radio Button.

Much better control of the formatting.

John