Align RadioButtonList Labels in Header of Datagrid

Posted on 2005-04-05
Medium Priority
Last Modified: 2010-05-18
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).


Question by:JohnDesautels
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 11

Expert Comment

ID: 13715358
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.



Author Comment

ID: 13726665

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).

LVL 11

Accepted Solution

sachiek earned 2000 total points
ID: 13733740
I suggest you to have single colum for each radio button.
Thatway it is easier to control.
And in each colum you can have a value.

Else there is otherway.

Look at this below sample.
It display vertically.

Now you modify the above code toward horizontal display with the help of this below code

You can acheive your required solution .
Hope you got it.

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 11

Expert Comment

ID: 13733745
If you did'nt get it let me know please.


Author Comment

ID: 13738175
Thanks, Sachi.

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

I will revisit when I return.


Author Comment

ID: 13908244
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.


Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question