radio button checked - asp faq?

Results 1 to 2 of 2

Thread: radio button checked - asp faq?

  1. #1
    meea Guest

    Default radio button checked - asp faq?

    Can someone point me exact URL of ASP faq, where it shows if radio button is checked based in value retrieved off a record.<BR>if rs("color") = radio color value then display checked.<BR><BR>I can&#039;t find address to that article, getting syntax error.<BR><BR>Thanks in advance<BR>

  2. #2
    easy does it Guest

    Default RE: radio button checked - asp faq?

    You mean like this:<BR><BR>&#060;%<BR>chosenColor = RS("color")<BR>%&#062;<BR>&#060;INPUT Type=Radio Name=Color Value=Red <BR>&nbsp; &nbsp; &#060;% If chosenColor="Red" Then Response.Write "Checked" %&#062; &#062;<BR>&#060;INPUT Type=Radio Name=Color Value=Blue <BR>&nbsp; &nbsp; &#060;% If chosenColor="Blue" Then Response.Write "Checked" %&#062; &#062;<BR>&#060;INPUT Type=Radio Name=Color Value=Green <BR>&nbsp; &nbsp; &#060;% If chosenColor="Green" Then Response.Write "Checked" %&#062; &#062;<BR><BR>If you only have 2 or 3 or 4 radio buttons, then that system looks clumsy but is probably perfectly okay.<BR><BR>If you have a lot more buttons, then try driving it off an array:<BR><BR>&#060;%<BR>Colors = Array("Red","Green","Blue","Purple","Yellow","Whit e","Black","Orange")<BR>chosenColor = RS("color")<BR><BR>For cc = 0 To UBound(Colors)<BR>&nbsp; &nbsp; curColor = Color(cc)<BR>&nbsp; &nbsp; If curColor = chosenColor Then chk="Checked" Else chk=""<BR>%&#062;<BR>&nbsp; &nbsp; &#060;INPUT Type=Radio Name=Color Value="&#060;% = curColor %&#062;" &#060;% = chk %&#062; &#062;<BR>&#060;%<BR>Next<BR>%&#062;<BR><BR>Lot s and lots of other ways! If, for example, RS("Color") gives a *number* instead of a string, then there are a couple of really neat and simple tricks.<BR><BR>But this is, really, just learning how to program. Which is probably why you haven&#039;t seen an FAQ or the like. A good book or a good tutorial programming site would, once you digest it all, make this kind of thing much, much easier for you.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts