Solved

Radio button rating system

Posted on 2004-08-06
6
662 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
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Accepted Solution

by:
boulder_bum earned 125 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now