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
  #1  
Old 08-25-2007, 02: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
  #2  
Old 08-25-2007, 03:01 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 881
kingmaker is on a distinguished road
Send a message via MSN 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 "";
}
}

}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-27-2007, 11:14 PM
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  
Old 08-29-2007, 01: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  
Old 09-03-2007, 11:24 PM
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  
Old 09-05-2007, 09:50 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 278
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 Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Create Tabbed Menu like PulsePush aryan_passion2 PHP Programming 1 08-06-2009 12:59 AM
<asp:Menu> Control in Detail? poornima ASP and ASP.NET Programming 4 04-29-2008 09:33 PM
How to Populate menu using sitemap and asp .net menu control and c#: Archer C# Programming 3 04-29-2008 09: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 07:55 PM
Vertical menu or horizontal menu? capture Web Design Help 1 03-12-2007 06:25 PM


All times are GMT -7. The time now is 02:05 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0