Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


listbox

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,31103
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> listbox
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 listbox - 2/15/2006 4:06:15 AM   
  maich

 

Posts: 4
Score: 0
Joined: 2/15/2006
Status: offline
Hallo
how can i display data to a html table selected from a access table. the data is related to the data selected from a list box. eg you select a country in a listbox and all the cities in the selected country are displayed in the html table
 
 
Post #: 1
 
 RE: listbox - 2/16/2006 8:50:18 AM   
  csamuels


Posts: 42
Score: 0
Joined: 9/26/2005
Status: offline
i would open a ado connection and create a query for each country.  dump the contents of each recordset into a html table inside of its own div.  make the div name the country.  hide all the divs by setting visibiliity to hidden.  create a html select box with the country's and make use of the onchange event to the country's div visibility to visible

ado connection

dim routefile, conn, agentcode, rs, uwdroplist, query
dim puw, cuw, plob, clob
routefile = "c:\tasks\actagt2.mdb"
dim tries
set conn = CreateObject("ADODB.Connection") 'prep connection'
set rs = CreateObject("ADODB.Recordset") ' prep recordset'
tries = 0 ' clear tries counter'
do 'try to open connection to the db
   conn.open "DRIVER={Microsoft Access Driver (*.mdb)};" &_
             "DBQ=" & RouteFile & ";DefaultDir=;UID=;PWD=;"
   tries = tries + 1
   if (err.number <> 0) then 'if errored, close this connection
     conn.close
   end if
Loop While (Err.Number<>0) And tries < 10 'if errored, try again. MAX TRIES = 10
query = "Select * from MYTABLE where AGENT like '" & AgentCode & "%' order by agent"
rs.open query, conn
if rs.eof then
   response.write "<font color=red><b>Agent Code " & agentcode & " Not Found</b></font><br>"
   if not agentcode = "n/a" then
     response.write "<a href=" & Request.ServerVariables("SCRIPT_NAME") & "?action=add&code=" &_
                     agentcode & ">Click here to add this code</a>"
   end if
else
   response.write "<a href=" & Request.ServerVariables("SCRIPT_NAME") & "?action=modify&code=" &_
                  agentcode & ">Click here to change the UWs</a><br><BR>"
%>
<table border="1" cellspacing="2" cellpadding="2">
 <thead>
 <tr>
  <th>Agent Code & LOB</th>
  <th>UW</th>
 </tr>
 </thead>
 <tbody>
 <%
 Do While Not rs.EOF
  %>
  <tr>
   <td><%= rs.Fields("Agent").Value %></td>
   <td><%= rs.Fields("ENDT").Value %></td>
  </tr>
  <%
  rs.MoveNext
 Loop
 %>
 </tbody>
 </table>
<%
end if
rs.close
set rs = nothing
conn.close
set conn = nothing



visibility

// SHOW / HIDE USER INPUTS
function select() {
//alert(document.values.description.selectedIndex);
var desc = "<%= Request.querystring("description") %>";
if (desc == "faxes_sent")
{
document.getElementById("userid1").style.visibility = "visible";
document.getElementById("userid2").style.visibility = "visible";
}
else if (desc == "md_nb_count")
{
document.getElementById("userid1").style.visibility = "hidden";
document.getElementById("userid2").style.visibility = "hidden";
}
}


< Message edited by csamuels -- 2/16/2006 8:54:46 AM >

(in reply to maich)
 
 
Post #: 2
 
 RE: listbox - 2/17/2006 9:33:20 PM   
  maich

 

Posts: 4
Score: 0
Joined: 2/15/2006
Status: offline
thanks alot CSamuels, i hope the code works. see ya

(in reply to csamuels)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> listbox Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts