IT Community - Software Programming, Web Development and Technical Support

AJAX Menu from XML

This is a discussion on AJAX Menu from XML within the ASP and ASP.NET Programming forums, part of the Web Development category; Hey, anybody tell me how to create a AJAX based menu which reads data from XML thanks in advance...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 08-25-2007, 03:34 AM
SaravananJ SaravananJ is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 79
SaravananJ is on a distinguished road
Question AJAX Menu from XML

Hey, anybody tell me how to create a AJAX based menu which reads data from XML

thanks in advance
__________________
J.Saravanan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-25-2007, 04:01 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Smile Re: AJAX Menu from XML

hi,
i hope it may help you.

make your aspx page like this:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>

<script type="text/javascript">
function call()
{
document.getElementById("show").style.left="5px";
document.getElementById("show").style.top="40px";
document.getElementById("show").style.display="blo ck";
}
function call1()
{
document.getElementById("show").style.display="non e";
}
</script>

</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<table>
<tr>
<td valign="middle" width="76" onmouseover="call()" onmouseout="call1()">
<a href="#">Product</a>
<div runat="server" id="show" style="display: none; position: absolute; border-bottom: solid 1px #dcdcdc;
border-left: solid 1px #dcdcdc; border-right: solid 1px #dcdcdc;">
<%# menu()%>
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>


in codebehind:
using System.Xml;

public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
this.DataBind();
}

protected string menu()
{
try
{
XmlDataDocument xmlDoc = new XmlDataDocument();
xmlDoc.Load(Server.MapPath("ProductList.xml"));
XmlNodeList xlist = xmlDoc.GetElementsByTagName("Product");

string showmenu = "";
showmenu = "<table cellspacing=5 width=150px runat=\"server\" align=\"left\" id=\"check\" style=\"background-color:White\" >";
for (int i = 0; i < xlist.Count; i++)
{

showmenu = showmenu + "<tr id=\"n" + i + "\" onmouseout=\"call3('n" + i + "')\" runai=\"server\" onmouseover=\"call2('n" + i + "')\" align=\"left\" ><td><a style=\"text-decoration:none;font-family: Tahoma;font-size: 11px;color: #7F7F7F;\" href=\"ParticularProduct.aspx?productId=" + xlist[i].ChildNodes[0].InnerText + "\">&nbsp;&nbsp;&nbsp;&nbsp;" + xlist[i].ChildNodes[1].InnerText + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;</a></td></tr>";

}

showmenu = showmenu + "</table>";
return showmenu;
}
catch
{
return "";
}
}

}
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-28-2007, 12:14 AM
SaravananJ SaravananJ is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 79
SaravananJ is on a distinguished road
Default Re: AJAX Menu from XML

Quote:
Originally Posted by kingmaker View Post
hi,
i hope it may help you.

make your aspx page like this:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>

<script type="text/javascript">
function call()
{
document.getElementById("show").style.left="5px";
document.getElementById("show").style.top="40px";
document.getElementById("show").style.display="blo ck";
}
function call1()
{
document.getElementById("show").style.display="non e";
}
</script>

</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<table>
<tr>
<td valign="middle" width="76" onmouseover="call()" onmouseout="call1()">
<a href="#">Product</a>
<div runat="server" id="show" style="display: none; position: absolute; border-bottom: solid 1px #dcdcdc;
border-left: solid 1px #dcdcdc; border-right: solid 1px #dcdcdc;">
<%# menu()%>
</div>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>


in codebehind:
using System.Xml;

public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
this.DataBind();
}

protected string menu()
{
try
{
XmlDataDocument xmlDoc = new XmlDataDocument();
xmlDoc.Load(Server.MapPath("ProductList.xml"));
XmlNodeList xlist = xmlDoc.GetElementsByTagName("Product");

string showmenu = "";
showmenu = "<table cellspacing=5 width=150px runat=\"server\" align=\"left\" id=\"check\" style=\"background-color:White\" >";
for (int i = 0; i < xlist.Count; i++)
{

showmenu = showmenu + "<tr id=\"n" + i + "\" onmouseout=\"call3('n" + i + "')\" runai=\"server\" onmouseover=\"call2('n" + i + "')\" align=\"left\" ><td><a style=\"text-decoration:none;font-family: Tahoma;font-size: 11px;color: #7F7F7F;\" href=\"ParticularProduct.aspx?productId=" + xlist[i].ChildNodes[0].InnerText + "\">&nbsp;&nbsp;&nbsp;&nbsp;" + xlist[i].ChildNodes[1].InnerText + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;</a></td></tr>";

}

showmenu = showmenu + "</table>";
return showmenu;
}
catch
{
return "";
}
}

}
Hi Kingmaker,

Can you post me the XML structure for your code.....

Thanks in advance
__________________
J.Saravanan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-29-2007, 02:56 AM
smani smani is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 56
smani is on a distinguished road
Post Re: AJAX Menu from XML

hi

here is my XML file structure:

<?xml version="1.0" standalone="yes"?>
<ProductDataSet xmlns="http://tempuri.org/ProductDataSet.xsd">
<Product>
<Id>21e2b12e-ebb2-4247-835f-0f8f2765b434</Id>
<Name>test1</Name>
<Description>sdfsdfsdfsfs</Description>
<Created>2007-06-04T12:29:01.357+05:30</Created>
<ProductType>2</ProductType>
</Product>
<Product>
<Id>e4e896b9-02cf-4830-8861-43f98ba622e5</Id>
<Name>test</Name>
<Description />
<Created>2007-06-29T14:45:09.78+05:30</Created>
<ProductType>2</ProductType>
</Product>
<Product>
<Id>bc2895cc-6717-4b75-ab77-d2a2e01fc671</Id>
<Name>Test2</Name>
<Description />
<Created>2007-06-04T18:37:03.857+05:30</Created>
<ProductType>1</ProductType>
</Product>
</ProductDataSet>

Regards
Manivannan.s
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-04-2007, 12:24 AM
SaravananJ SaravananJ is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 79
SaravananJ is on a distinguished road
Default Re: AJAX Menu from XML

Hi,

Can you tell me, is it possible to create a menu with different background colors?
__________________
J.Saravanan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-05-2007, 10:50 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default Re: AJAX Menu from XML

Hi saravanan,

We can create the menus in different colors, for this you have to use menu control adapter, using the menu control adapter you can override any property.


thnx...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/3499-ajax-menu-xml.html
Posted By For Type Date
AJAX Menu from XML - Ajax This thread Refback 12-06-2007 01:33 PM
How To: AJAX Menu from XML - Ajax This thread Refback 10-10-2007 09:09 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
<asp:Menu> Control in Detail? poornima ASP and ASP.NET Programming 4 04-29-2008 10:33 PM
How to Populate menu using sitemap and asp .net menu control and c#: Archer C# Programming 3 04-29-2008 10:23 PM
how to use ajax in asp.net and how to install ajax in my system vel.m8 ASP and ASP.NET Programming 5 04-08-2008 08:55 PM
RightClick option for menu in Flash bluesky Flash Actionscript Programming 2 08-14-2007 12:16 AM
Vertical menu or horizontal menu? capture Web Design Help 1 03-12-2007 07:25 PM


All times are GMT -7. The time now is 08:22 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0