views:

185

answers:

1

I have never worked on classic ASP and unfortunately i am supposed to modify an old classisc ASP web site.

ASP.Net ViewState does take care of maintaining control's sate automatically. How do i do it in classic ASP ?

I have two radio buttons and a text box placed on my ASP page, when user types in something in the text box based on radio button selection we display different search results. Now what i need is to keep the previously selected radio button as checked after the page is postbacked. How do i do that ?

+1  A: 

You use Request.Forms["rbcontrolname"] to retreieve the posted back value and then render out the radio button with same value it had before. There is no concept of server controls in classic asp, html controls have to be used.

Ben Robinson
Oh you mean based on the Request.Forms["rbcontrolname"] value, i may have to render radio buttons with diffrent attributes ? Like if first button was checked previously i would render that control with checked="checked" ?
Nikhil Vaghela
@Nikhil yeah that is what you have to do. Look at the following code for info http://www.asp101.com/samples/viewasp.asp?file=radiobutton.asp scroll down till you see the "Radio Button Which Maintains Its State:" section
Waleed Al-Balooshi
@Nikhil, yes thats exactly what you would do.
Ben Robinson
Thanks, Ben and Waleed.I appreciate that.
Nikhil Vaghela