?
Solved

Layout Options for ASP.net Radio Buttons

Posted on 2005-03-21
8
Medium Priority
?
241 Views
Last Modified: 2012-05-05
I have a survey form created with the layout I want.  Now I need to convert my HTML <inputs> to radio button lists (each row is a new group).  

The reason I need to convert to ASP.net radios is because I need to preserve my viewstate if an error occurs.  Right now, an error occurs and the form is reset when a radio group is unanswered.  

Example at: http://nicic.org/applications/surveys/NeedsAssessment/Default2.aspx?Section=4
0
Comment
Question by:stengelj
  • 4
  • 3
8 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 13598024
stengelj,

I have moved this to the ASP.NET topic where I think you have a better chance of getting a solution.

COBOLdinosaur
Page Editor, Web Languages.
0
 
LVL 9

Author Comment

by:stengelj
ID: 13598441
Thank you.  I get confused between "Web Dev" and "Programming".  Now I get it--thank you.
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 2000 total points
ID: 13598765
>>The reason I need to convert to ASP.net radios is because I need to preserve my viewstate if an error occurs
u could still manage it with the HTML controls .. u just have to add the runat=server to these HTML radio buttons ...
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 9

Author Comment

by:stengelj
ID: 13600743
Like this?

<input type="radio" id="myRadio" name="myRadio" runat="server" value="my value">

I didn't think I could do this.  I will try it this morning and report back.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 13600770
s, thats the way !!
0
 
LVL 9

Author Comment

by:stengelj
ID: 13602638
Yes, that did work but I had to change the double quotes to single quotes like this:

<input type='radio' id='myRadio' name='myRadio' runat='server' value='my value'>

Unfortunately, it exposed another problem for me in that I was assigning a dynamic identifyer for my ID and I can't do that when I add the "runat='server'".  

Like: <input id="myRadio_<% myID %>" ... >

I guess I'll have to re-evaluate my approach to this.  Unless anyone else has a suggestion for me, Rejojohny has answered my question and I'll close it out soon.

Thank you Rejojohny.
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 13608747
thx for the points .. I would advice you that it would be better to use web controls and HTML controls where approriate .. in ur case, i think a web control is more approriate .. if u have to give a dynamic id to the controls .. think about creating dynamic controls .. but then that has its own set of problems .. like viewstate not been maintained unless the controls are created in the init event of the page etc ..
0
 
LVL 9

Author Comment

by:stengelj
ID: 13608786
You're welcome...you did answer my question and it'll probably help me out with somthing else I'm working on.

I did find some stuff relating to what you're saying but I ended up taking a whole new direction (with parameters-yuck!).  It's quick and dirty but it works for what I need.  I just have a little temporary project that I don't want to invest too much energy into...Thanks again.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

609 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