473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Dropdown menu using xml file

Can anyone please help me. I was looking at the article "http://www.eggheadcafe.com/articles/20030603.asp". I am new to .net and know nothing in c#. I want to write a menu in asp.net. Can anyone please help me in converting this c# code to vb.net. 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()
xslt.Load(XslSystemFileName)
XPathDocument xpathdocument = ne
XPathDocument(XmlSystemFileName);
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

InitializeComponent()
base.OnInit(e)
private void InitializeComponent(
{
this.Load += new System.EventHandler(this.Page_Load)

#endregio


And here is the vb.net 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
Ge
Return (xmlFile
End Ge
Set(ByVal Value As String
xmlFile = valu
End Se
End Propert
Public Property XslFileName() As Strin
Ge
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(
xslt.Load(XslSystemFileName

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

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

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

'xslt.Transform(doc
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.
InitializeComponent()
End Sub

#End Region
End Class
End Namespace
Your help will be greatly appreciated. Thanks for your help in advance.
Nov 12 '05 #1
0 3367

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: djharrison | last post by:
I'm new to ASP and database programming but I am trying to connect to a database using a concatenation of a strings and a menu item from a form. Ok here's what I have... an asp form that has a...
1
by: middletree | last post by:
For an ASp Intranet app, I have some code that should work, but I am not able to make it happen for some reason, after spending considerable time on this. I am pretty thick when it comes to...
5
by: michael | last post by:
How may the following script be modified to function with the list structure below it? In short: it is meant to apply a background style to groups of LI's and ULs depeding on the URL filename. ...
1
by: GatorBait | last post by:
Hi all, I'm using the new ToolStrip control in a project and I'm running into a problem that I'm hoping someone can help me with. I am building the toolstrip in code by adding buttons,...
4
torquehero
by: torquehero | last post by:
Hi all :) I have created a horizontal navbar using Xara Menumaker. The Menu items have several dropdown menus. Its a javascript. When the mouse cursor is moved over any menu item, a dropdown...
5
by: balu435 | last post by:
Hi friends, I have an (VBA) application which programatically fills the options in a web page. I have an dropdown menu whose options are selected during run-time by using a function.Is there...
0
by: Shashank | last post by:
Hi all, I have made a toolbar in c# using toolstrip control. I am using xml file to generate menu at runtime and then binding it to the dropdown button. My problem is that when I click the...
2
by: William Youngman | last post by:
We are developing an application that presents data to the user in a gridview and we are using the dropdown extender to give the user a SharePoint 2007 type dropdown menu attached to the cells of a...
1
by: camphor | last post by:
hi, I have a single column webpage with a horizontal dropdown menu and am trying to make the nav bar fit across the page, the column is 800px, it looks ok in dreamweaver 8 but when I test it in...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.