Hi,
I am still not able to get this working in a simple page. Please help me. I am badly stuck....
I am trying to view the contents of the Beverage Category. I have built it like a hierarchy in the form of styled <UL> tags.
Please assist me in combining the 2 pages into one page. I would extremely grateful.
My code is:
Categories_Dyna mic.asp -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-
<html>
-
<!--#INCLUDE Virtual="/Scripts/Padmaja/Testing2/DB_Northwind.asp"-->
-
<head>
-
<style type="text/css">
-
* {
-
border: 0;
-
padding: 0;
-
margin: 0;
-
}
-
-
#menu {
-
padding:0;
-
margin:0;
-
}
-
#menu li {
-
list-style-type:none;
-
}
-
-
#menu ul {
-
padding: 0;
-
margin: 6px;
-
list-style-type: none;
-
}
-
-
a.a_style:link {color:#0000ff; text-decoration:none;}
-
a.a_style:visited {color:#0000ff; text-decoration:none;}
-
a.a_style:hover {color:#ff0000; text-decoration:underline;}
-
a.a_style:hover {color:#ff0000; text-decoration:underline;}
-
-
</style>
-
-
<script type="text/javascript">
-
-
var xmlHttp
-
-
function showProducts(str)
-
{
-
xmlHttp=GetXmlHttpObject()
-
if (xmlHttp==null)
-
{
-
alert ("Browser does not support HTTP Request")
-
return
-
}
-
-
var url="getProducts.asp"
-
url=url+"?ID="+str
-
//alert(url);
-
//url=url+"&sid="+Math.random()
-
xmlHttp.onreadystatechange=stateChanged1
-
xmlHttp.open("GET",url,true)
-
xmlHttp.send(null)
-
}
-
-
function stateChanged1()
-
{
-
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
-
{
-
//objID = 'UI_'+el;
-
//document.getElementById(objID).innerHTML=xmlHttp.responseText
-
document.getElementById("content_products").innerHTML=xmlHttp.responseText
-
}
-
}
-
-
function GetXmlHttpObject()
-
{
-
var objXMLHttp=null
-
if (window.XMLHttpRequest) //Safari, Mozilla browers
-
{
-
objXMLHttp=new XMLHttpRequest()
-
}
-
else if (window.ActiveXObject) //IE browsers
-
{
-
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
-
}
-
return objXMLHttp
-
}
-
-
function s_Hide(el){
-
//alert("Showing Element: "+el);
-
objID = 'UI_'+el;
-
//alert(objID);
-
obj = document.getElementById(objID).style;
-
(obj.display == 'none')? obj.display = 'block' : obj.display = 'none';
-
}
-
-
</script>
-
-
<title>On Demand Building of tree with User OnClick</title>
-
</head>
-
-
<body>
-
-
<form name="Customers" id="Customers" action="">
-
-
<%
-
-
Dim rs
-
Set rs = Server.CreateObject("ADODB.Recordset")
-
sSQL = "SELECT CategoryID, CategoryName FROM Categories WHERE CategoryID = 2"
-
-
rs.open sSQL, Conn
-
-
Dim aCategory
-
-
If not rs.EOF Then
-
'Dump the recordset into the above array
-
aCategory = rs.getRows()
-
-
rs.Close
-
Set rs = Nothing
-
-
Dim iRows
-
-
For iRows = 0 to UBound(aCategory, 2)
-
CatID = aCategory(0, iRows)
-
%>
-
<ul id="menu">
-
<li>
-
<input type="radio" checked name="prodid" id="Catid<%=aCategory(0, iRows)%>" value="<%=aCategory(0, iRows)%>">
-
<a href="#" class="a_style" onclick="showProducts(<%=aCategory(0, iRows)%>);s_Hide('<%=aCategory(0, iRows)%>'); return false;"><%=aCategory(1, iRows)%></a>
-
<ul id="UI_<%=aCategory(0, iRows)%>">
-
<%
-
'QS = Request.Querystring("ID")
-
'Now pass the querystring to the following function.
-
'if QS = trim(aCategory(0, iRows)) then
-
'Call GetProducts (CatID, Counter)
-
'end if
-
%>
-
<div id="content_products">
-
</div>
-
</ul>
-
</li>
-
</ul>
-
<%
-
Next 'iRows
-
End If
-
%>
-
</form>
-
</body>
-
</html>
-
<%
-
Conn.Close
-
Set Conn = Nothing
-
%>
-
getProducts.asp -
<%
-
ProdID = Request.Querystring("ID")
-
'Response.Write ProdID
-
Call GetProducts (ProdID, Counter)
-
-
-
startTime = Now()
-
-
'get the Products using a function
-
-
Function GetProducts(ProdID, Counter)
-
-
sql = "SELECT CategoryID, ProductName, ProductID FROM Products " & _
-
"where CategoryID = " & ProdID & " " & _
-
"order by ProductName "
-
-
'Response.Write sql
-
'Response.End
-
-
Dim rs2
-
set rs2 = Server.CreateObject("ADODB.Recordset")
-
rs2.open sql, Conn
-
-
Dim aProducts
-
-
If not rs2.EOF then
-
-
aProducts = rs2.GetRows()
-
-
'Close Recordset to use the new array with the 2 columns data
-
rs2.Close()
-
set rs2 = Nothing
-
-
'Declare Constants for the above SQL columns for better readability
-
'Use these Constants instead of referring to the array numeric indexes
-
Const c_CatID = 0
-
Const c_ProductName = 1
-
Const c_ProductID = 2
-
-
'Ubound(MyArray,1) 'Returns the Number of Columns
-
'Ubound(MyArray,2) 'Returns the Number of Rows
-
-
Dim iRowLoop
-
-
For iRowLoop = 0 to UBound(aProducts, 2)
-
%>
-
<li>
-
<input type="radio" name="prodid" id="prodid<%=aProducts(c_ProductID,iRowLoop)%>" value="<%=aProducts(c_ProductID,iRowLoop)%>">
-
<%=aProducts(c_ProductName,iRowLoop)%>
-
<%
-
Counter = Counter + 1
-
Counter = Counter - 1
-
%>
-
</li>
-
<%
-
Next 'iRowLoop
-
End If 'rs2.EOF
-
-
End Function
-
%>
-
-
Thanks. Any input how to combine the two pages into one page?
1 2475 acoder 16,027
Recognized Expert Moderator MVP
You could combine both pages into one, but it'd just make maintenance more difficult. You'd have to have separate code within one page - one for the normal page and the other for Ajax-called code. It's much easier to maintain separated.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: yabba |
last post by:
w2k server... after rebooting the event viewer/application log shows multiple
restarts of Active Server Pages and they continue to build in memory as each
start produces a IWAM_SERVERNAME in the task manager.
there might be 10 - 20 starts without a stop... when I restart iis services it
takes a long time as each started service is stopped and the associated
IWAM_SERVERNAME is closed.
this seems to be something new and when checking...
|
by: Adrian |
last post by:
Hi All,
I am a big fan of the Codebehind model. I would like to continue to
keep my .ASPX pages FREE of any 'LOGIC' and keep it PURE 'HTML'. I
would like to know how many of you handle the following situation.
(In pseudo code to illustrate my point)
<html>
<body>
if (condition)
|
by: robert.differentone |
last post by:
It is possible to fetch html/php pages using AJAX. How can I load the
fetched page? i.e. I want to use AJAX to prefetech pages ( imitate
cache). Does anybody knows how to do it? Any help is appreciated !
Thanks,
R.
|
by: Kristen |
last post by:
I am using ASP.Net 2.0 and I need to create a web page on the fly based
on what information is in the database. The page is going to have
certain controls like text boxes and labels and buttons. I was
wondering what the best method is to carry this out. I was thinking
about using a class to generate the HTML on the fly or maybe a stored
procedure. Can anyone point me in the right direction? Thanks
|
by: celoftis |
last post by:
Using VS 2005:
This morning, following the instructions here:
http://ajax.asp.net/docs/overview/InstallingASPNETAJAX.aspx,
I installed ASP.NET AJAX on my WinXP Pro development machine. Following
that, I installed the "November 2006 CTP" and "Control Toolkit" - then
I re-booted my machine.
Next I tried to create a simple, sample page...
I have the AJAX controls in my toolbox, but when I drag on onto my page
it gets underlined - denoting...
| |
by: =?Utf-8?B?TGFycnkgRXBu?= |
last post by:
I have an app using Ajax. The scriptmanager is within the form that is
within the master page. I also have web user controls that are doing partial
rendering and are "borrowing" or "inheriting" the scriptmanager from the
master page. Heck, when they're rendered, the scriptmanager is on all the
pages and it works.
However, in the VS2005 designer, I constantly see "Can't render image"
errors, and it's nearly impossible to effectively use...
|
by: Arthur Dent |
last post by:
Hello all, I have a site which was a .NET 2.0 AJAX 1.0 site.
I opened it up in VWDExpress 2008, and changed it to a 3.5 site, then
subsequently changed it back to a 2.0 site.
Now, my references to AJAX no longer work. The web server has both the new
(3.5), And old versions (1.0.61025.0) installed.
If I look at the references in my project properties, it shows
System.Web.Extensions, 1.0.61025.0 as an included reference, from the GAC.
|
by: wizdom |
last post by:
I've tried a few things but nothing seems to work, i'm starting to think this isnt possible.
I basically am looking to have the user click on the video number, then have the video load in its own section on the page. I'm currently using iframes as a work around and have been trying to read up on Ajax as another way around it. Problem is, i think using iframes i'm losing important keywords that would usually be right on the page. i initially...
|
by: FreshRob |
last post by:
I have been trying to fix this issue the whole of today and have gotten no where.
I am developing a new website, and wanted it to display a webpage in lightbox and have an external page added to the main page, both worked successfully apart, but it wasn't until I combined them that I have had an issue.
My aim was to have ajax add the external page into a div and then load lightbox from that div, though that is where the problem lies as I can...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |