By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,359 Members | 1,543 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,359 IT Pros & Developers. It's quick & easy.

Dropdown menu using xml file

P: n/a
Can anyone please help me. I was looking at the article "". I am new to .net and know nothing in c#. I want to write a menu in Can anyone please help me in converting this c# code to I tried, but it is not giving the output. Here is the c# code

using System
using System.Collections
using System.ComponentModel
using System.Data
using System.Drawing
using System.Web
using System.Web.SessionState
using System.Web.UI
using System.Web.UI.WebControls
using System.Web.UI.HtmlControls
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.IO;
using System.Text;

namespace MenuContro

public class PageMenu : System.Web.UI.UserControl
protected Label MenuPlaceHolder;
private string xmlFile = String.Empty;
private string xslFile = String.Empty;
public string XmlFileName
get { return(xmlFile); }
set {xmlFile = value;}
public string XslFileName
get { return(xslFile); }
set {xslFile = value;}
private void Page_Load(object sender, System.EventArgs e)
string XmlSystemFileName = Server.MapPath(xmlFile);
string XslSystemFileName = Server.MapPath(xslFile);
XslTransform xslt = new XslTransform()
XPathDocument xpathdocument = ne
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
xslt.Transform(xpathdocument, null, sw, null)
MenuPlaceHolder.Text = sb.ToString();

#region Web Form Designer generated cod
override protected void OnInit(EventArgs e

private void InitializeComponent(
this.Load += new System.EventHandler(this.Page_Load)


And here is the code that i converted. Anyone please tell me if this is correct or not

Imports Syste
Imports System.Collection
Imports System.ComponentMode
Imports System.Dat
Imports System.Drawin
Imports System.We
Imports System.Web.SessionStat
Imports System.Web.U
Imports System.Web.UI.WebControl
Imports System.Web.UI.HtmlControl
Imports System.Xm
Imports System.Xml.Xs
Imports System.Xml.XPat
Imports System.I
Imports System.Tex

Namespace MenuContro
Public Class PageMen
Inherits System.Web.UI.UserContro
Protected MenuPlaceHolder As System.Web.UI.WebControls.Labe
Private xmlFile As String = String.Empt
Private xslFile As String = String.Empt
Public Property XmlFileName() As Strin
Return (xmlFile
End Ge
Set(ByVal Value As String
xmlFile = valu
End Se
End Propert
Public Property XslFileName() As Strin
Return (xslFile
End Ge
Set(ByVal Value As String
xslFile = valu
End Se
End Propert

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Loa
Dim XmlSystemFileName As String = Server.MapPath(xmlFile
Dim XslSystemFileName As String = Server.MapPath(xslFile
Dim xslt As XslTransform = New XslTransform(

'//Instantiate the XPathDocument Clas
Dim doc As XPathDocument = New XPathDocument(XmlSystemFileName

'//Instantiate the XslTransform Clas
Dim transform As XslTransform = New XslTransform(

'XPathDocument xpathdocument = Ne
Dim sb As StringBuilder = New StringBuilder(
Dim sw As StringWriter = New StringWriter(sb
'xslt.Transform(XPathDocument, Nothing, sw, Nothing)

MenuPlaceHolder.Text = sb.ToString()
End Sub
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
End Sub

#End Region
End Class
End Namespace
Your help will be greatly appreciated. Thanks for your help in advance.
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.