473,548 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Collecti ons
using System.Componen tModel
using System.Data
using System.Drawing
using System.Web
using System.Web.Sess ionState
using System.Web.UI
using System.Web.UI.W ebControls
using System.Web.UI.H tmlControls
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPat h;
using System.IO;
using System.Text;

namespace MenuContro

public class PageMenu : System.Web.UI.U serControl
{
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(objec t sender, System.EventArg s e)
{
string XmlSystemFileNa me = Server.MapPath( xmlFile);
string XslSystemFileNa me = Server.MapPath( xslFile);
XslTransform xslt = new XslTransform()
xslt.Load(XslSy stemFileName)
XPathDocument xpathdocument = ne
XPathDocument(X mlSystemFileNam e);
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(EventArg s e

InitializeCompo nent()
base.OnInit(e)
private void InitializeCompo nent(
{
this.Load += new System.EventHan dler(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.Collecti on
Imports System.Componen tMode
Imports System.Dat
Imports System.Drawin
Imports System.We
Imports System.Web.Sess ionStat
Imports System.Web.U
Imports System.Web.UI.W ebControl
Imports System.Web.UI.H tmlControl
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.U serContro
Protected MenuPlaceHolder As System.Web.UI.W ebControls.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.EventArg s) Handles MyBase.Loa
Dim XmlSystemFileNa me As String = Server.MapPath( xmlFile
Dim XslSystemFileNa me As String = Server.MapPath( xslFile
Dim xslt As XslTransform = New XslTransform(
xslt.Load(XslSy stemFileName

'//Instantiate the XPathDocument Clas
Dim doc As XPathDocument = New XPathDocument(X mlSystemFileNam e

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

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

'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.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
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 3391

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

Similar topics

1
3349
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 dropdown menu list that finds *.mdb files in the current folder. It also has a 'Select' button on it. I want the user click select and either in this...
1
2933
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 javascript; I just don't get the syntax at all. If anyone could help, I would appreciate it. I'm probably pretty close. Please note that because it's an...
5
1583
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. <style> ..high {background-color: #99FFCC;} ..low {background-color: #33CC00;} </style>
1
3051
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, seperators, and dropdown buttons (which have MenuItems added to it). The ToolStrip gets built perfectly, but the problem I am having is accessing the click...
4
2310
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 list/menu appears. When the page is opened in the browser (as it appears by default), the dropdown menu positions are correctly displayed. But when I...
5
3575
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 anyway by which I can select the option in the dropdown menu programatically? If the dropdown menu had its options explicitily mentioned (like <option...
0
1212
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 dropdown button for the first time the menu, the dropdown doesn't appear. On the second and all subsequent clicks, the dropdown is visible and is...
2
10272
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 given column. We are also using another dropdown menu that the user can use to select data using another quesry using the SelectedIndex change method....
1
6604
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 firefox, the nav bar which is a horizontal blue stripe with the links written inside it doesn't stretch the whole 800px, also how would you align the...
19
3658
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 code for this from a tutorial but that menu was flush-left justified. Not what I want. Subsequent searches on google on how to center yielded a
0
7444
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7954
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6039
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5367
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.