Solved

postback and HTML control

Posted on 2011-03-06
2
394 Views
Last Modified: 2012-05-11
I have an ASP page.  It has two HTML radio buttons.  When a postback occurs - I think I'm describing this correctly - I lose the selection of the two HTML radio buttons.  This is because the page is being sent again, correct?  How do I save the state of my two HTML radio buttons?
0
Comment
Question by:HLRosenberger
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 35046643
If you give each control and "id", "runat" and "enableviewstate" attribute, they will get wrapped as Html server controls and will retain their values. So you definition would be something like:
<input type="radio" name="rb1" value="1" id="rb1" runat="server" enableviewstate="true" />

Open in new window

0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 35047138
Thanks!  That did the trick.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

743 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

14 Experts available now in Live!

Get 1:1 Help Now