Active Server Pages Programming (ASP)/ASP radio button query

Advertisement


Question
QUESTION: suppose we have a list of accounts from which some are expired and some are not expired. and whole list of expired and not expired is in xml file and we want to display through a radio button in asp so that if we click on expire then rxpired list to be shown and if we click on not expired then not expired list to be shown..how can dat be done?

ANSWER: Hi,

I believe you are using classic asp

Here is the logic

Dim objxml
  Set objxml = Server.CreateObject("Microsoft.XMLDOM")
  objxml.async = False
  objxml.load (Server.MapPath("GiveYourXMlFileName"))
  
set ElemValue1  = objxml.getElementsByTagName("property")
set ElemValue2  = objxml.getElementsByTagName("property/type/en")
set ElemValue3  = objxml.getElementsByTagName("property/town/en")
set ElemValue4  = objxml.getElementsByTagName("property/province/en")   


For i=0 To (ElemProperty.length -1)
   if ElemValue1.item(i).Text = "Expired" and expiredRadioButtonChecked then
         Display all expired elemvalues
   end if
   if ElemValue1.item(i).Text  = "Not Expired" and NotexpiredRadioButtonChecked then
         Display all not expired values....
   end if
next
Set objxml = Nothing

Happy programming

Cheers

-Srini

---------- FOLLOW-UP ----------

QUESTION: actually the problem is the page already has a button named "get destinations"and when we click on it, it gives the list of all expired and not expired accounts and i want a radio button so that if I select expired radiooption so i should get only expired accounts and same in case of not expired. and i dont want to use any other button for the clicking i just want to do that with the same "get destinations" button. i used this code..

<form name="frmSearch" method="post" runat="server">
<table border="1" cellpadding="2" cellspacing="0" align="left" style="width: 656px">
 <tr bgcolor="#C0C0C0" >
   <td  colspan="2">Search by CLI: </td>
 </tr>
 <tr>
     <td bgColor=#f5f5f5 align=left>CLI:</td>
       <td  bgColor=#f5f5f5 align=left nowrap >
         <input type=text name=txtcli id=txtPin />             
         <input type="submit" name="btnCli" value="Get Destinations"  style="font-size:7pt; font-family: Verdana; padding:0px; margin:0px; background:#D7D4F0">
       </td>
       <td> <form action="http://172.16.18.13/servicerest/expiredestination.php?action=getdestsandcli&cli=("cli")&"&pin="&request.QueryString("pin")&"view="& >
<input type="radio" name="radiobutton1" value="expired"> Expired    
<input type="radio" name="radiobutton1" value="not expired"> Not Expired
<input type="submit" name="btnCli" value="Get Destinations" style="font-size:7pt; font-family: Verdana; padding:0px; margin:0px; background:#D7D4F0">

</form>
       </td>    
 </tr>
</table>
</form>

<%
if request.Form("btnCli")<>"" then
response.Redirect "/TAMS/Customer_Service/Search/viewDestinations.asp?opt=cli&cli="&request("txtcli")&"&pin="&request("pin")
end if
%>

Answer
Hi,

As I explained, you need to filter in the for each loop which one you want to display...

add two radio buttons and a button on click of the button add a validation, here is the link gives you how to get which one clicked and display accordingly

http://www.asp101.com/samples/viewasp.asp?file=radiobutton.asp

Cheers

-Srini

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.