?
Solved

Radio button rating system

Posted on 2004-08-06
6
Medium Priority
?
669 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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