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...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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 + "\"> " + xlist[i].ChildNodes[1].InnerText + " & nbsp; &nb sp;</a></td></tr>"; } showmenu = showmenu + "</table>"; return showmenu; } catch { return ""; } } } |
| |||
| Quote:
Can you post me the XML structure for your code..... Thanks in advance
__________________ J.Saravanan |
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |