Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Radio button rating system

Posted on 2004-08-06
6
Medium Priority
?
670 Views
Last Modified: 2008-03-06
Hello all!

I am newly getting into creating ASP pages.  I need to create a very simple data entry form so that the user can rate several items.  What I want to have is the item in question on the left hand side, and then on the right hand side a control that has 1-10 layed out like this.

Item 1 -           1 2 3 4 5 6 7 8 9 10

With a radio button above each number.  Only one of the buttons can be checked at a time.

Is there any easy way to go about doing this?  Ive tried in Web Matrix but I can't seem to create a radio button with the button on top and the text on the bottom.

Any help is appreciated.

Chris
0
Comment
Question by:Krys_Wilson
[X]
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
6 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 11739160
I'd make a UserControl that would do this if I were you.  I'm imagining that you are going to reuse this...
0
 
LVL 3

Expert Comment

by:GrumbleBot
ID: 11739476
I would probably suggest what raterus said too.

But if you are not sure on how to do that you can do it very simply by adding a radiobutonlist and adding ten items giving each one a value 0-9 and text being a space. Then create 10 labels and number them 0-9 and position them directly above the radio buttons. You can then add an event for SelectedIndexChanged.

Hope this helps.
0
 
LVL 33

Expert Comment

by:raterus
ID: 11739540
The only problem I see with that solution is that the radiobuttonlist is going to render in it's own table, so even if you created some labels below it, there is no html guarantee that they will line up correctly.  Another possibility which would work great if you could figure out how is to just use the radiobuttonlist, but override the render event and separate the text from the button like you want it.  Not easy though..
0
Technology Partners: 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 8

Accepted Solution

by:
boulder_bum earned 500 total points
ID: 11739796
"Is there any easy way to go about doing this?"

Very much yes, with the RadioButtonList mentioned above.

Example:

http://it.maconstate.edu/tutorials/ASPNET/ASPNET06/aspnet06-01.aspx

<SCRIPT runat="server">

Sub Page_Load

  If Not Page.IsPostBack Then

    MyList.Items.Add(New ListItem("Red","R"))
    MyList.Items.Add(New ListItem("Green","G"))
    MyList.Items.Add(New ListItem("Blue","B"))

    MyList.Items(0).Selected = True

  End If

End Sub

Sub GetSelectedButton (Src As Object, Args As EventArgs)

  Dim Item As ListItem
  For Each Item in MyList.Items
    If Item.Selected = True Then
      TextProperty.Text = Item.Text
      ValueProperty.Text = Item.Value
    End If
  Next

End Sub

</SCRIPT>

<asp:RadioButtonList id="MyList" runat="server"/>

<asp:Button Text="Get Button" OnClick="GetSelectedButton" runat="server"/>
<b>Item.Text: </b><asp:TextBox id="TextProperty" Size="1" runat="server"/>
<b>Item.Value: </b><asp:TextBox id="ValueProperty" Size="1" runat="server"/>





For aligning text ON TOP of the radio button list, you can make a table with 2 rows, one for each rating/radio button pair (rating on top row, radio button on second). You'd then assign each RadioButton's GroupName property to be identical.

This doc describes processing:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskrespondingtouserselectioninradiobuttongroup.asp


0
 
LVL 5

Author Comment

by:Krys_Wilson
ID: 11740042
Ive got to leave work early, I will defiantely check over these solutions and let you guys know.

Thanks for the help!

Chris
0
 
LVL 5

Author Comment

by:Krys_Wilson
ID: 11755528
Thanks everyone for responding and for waiting over the weekend!  I appreciate all the posts and I went with Boulder Bum's solution.

Thanks again!

Chris
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
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

598 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