[thelist] [ASP.NET] CHECKED attribute of radio button --problemsetting it within asp repeater
Michele Foster (WizarDev)
michele at wizardev.ca
Thu Apr 14 12:03:52 CDT 2005
----- 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.
>
Jason,
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"""%> />
or
<input type="radio" name="SexWith" id="SexWith" value="jason" <%If MyField =
"jason" then response.write " checked=""checked"""%> />
HTH,
Michele
More information about the thelist
mailing list