[thelist] [ASP.NET] CHECKED attribute of radio button--problemsetting it within asp repeater

Jonathan R. Karlen jkarlen at infoniq.com
Thu Apr 14 20:20:57 CDT 2005

Oh.  I didn't read this carefully enough.  I had assumed you were using
ASP.NET checkboxes or radio buttons.  This first begs the question - why

Jonathan R. Karlen
President/Senior Developer
Infoniq E-Business Solutions, Inc.
jkarlen at infoniq.com

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Michele Foster
Sent: Thursday, April 14, 2005 1:04 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] [ASP.NET] CHECKED attribute of radio
button--problemsetting it within asp repeater

----- Original Message ----- 
From: "Jason Handby" <jasonh at corestar.co.uk>

> > Have your dataset use either true or false rather than "CHECKED".
> >
> > Then, do something like
> >
> > Checked=<%# Container.DataItem("IsActiveChecked") %>
> I tried that -- it doesn't work. The browser interprets 
> "Checked=anything" as being the same as "Checked". It seems that only 
> the presence of the attribute "Checked" counts, not what it's set to.


You need to evaluate your value before you even write out checked= .  I
don't know ASP.net, but in ASP I would do something like ..

<input type="radio" name="WantSex" id="WantSex" value="1" <%If MyField then
response.write " checked=""checked"""%> />


<input type="radio" name="SexWith" id="SexWith" value="jason" <%If MyField =
"jason" then response.write " checked=""checked"""%> />



* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 

More information about the thelist mailing list