473,399 Members | 4,177 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,399 software developers and data experts.

converting this code to C#, how??

Dear reader!

ASP.NET 2.0

How should this line with vb.net code:
e.Item.ImageUrl = CType(e.Item.DataItem, SiteMapNode)("ImageUrl");
be as C#?????

I want to put the code into MenuItemDataBound(object sender, MenuEventArgs
e)
eventhandler.

I came across this vb.net code on the web, but I'm programming in C# so I
need to convert it into C# for to be able to use it

Any suggestions?

Jeff
Feb 22 '07 #1
4 1329
e.Item.ImageUrl = (SiteMapNode) e.Item.DataItem("ImageUrl");


"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
Dear reader!

ASP.NET 2.0

How should this line with vb.net code:

be as C#?????

I want to put the code into MenuItemDataBound(object sender, MenuEventArgs
e)
eventhandler.

I came across this vb.net code on the web, but I'm programming in C# so I
need to convert it into C# for to be able to use it

Any suggestions?

Jeff

Feb 22 '07 #2
Hmm, that gives me this error:
System.Web.UI.WebControls.MenuItem.DataItem' is a 'property' but is used
like a 'method'

"Scott M." <s-***@nospam.nospamwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
e.Item.ImageUrl = (SiteMapNode) e.Item.DataItem("ImageUrl");


"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
>Dear reader!

ASP.NET 2.0

How should this line with vb.net code:

be as C#?????

I want to put the code into MenuItemDataBound(object sender,
MenuEventArgs e)
eventhandler.

I came across this vb.net code on the web, but I'm programming in C# so I
need to convert it into C# for to be able to use it

Any suggestions?

Jeff


Feb 22 '07 #3
Try

Normally, you would do this.

e.Item.ImageUrl = ((SiteMapNode) e.Item.DataItem).ImageUrl;

but the sitemapnode object doesn't have an ImageUrl property so I'm assuming
it's an attribute.

e.Item.ImageUrl = ((SiteMapNode) e.Item.DataItem).Attributes["ImageUrl"];

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hmm, that gives me this error:
System.Web.UI.WebControls.MenuItem.DataItem' is a 'property' but is used
like a 'method'

"Scott M." <s-***@nospam.nospamwrote in message
news:Oi**************@TK2MSFTNGP03.phx.gbl...
>e.Item.ImageUrl = (SiteMapNode) e.Item.DataItem("ImageUrl");


"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uW**************@TK2MSFTNGP05.phx.gbl...
>>Dear reader!

ASP.NET 2.0

How should this line with vb.net code:

be as C#?????

I want to put the code into MenuItemDataBound(object sender,
MenuEventArgs e)
eventhandler.

I came across this vb.net code on the web, but I'm programming in C# so
I need to convert it into C# for to be able to use it

Any suggestions?

Jeff



Feb 22 '07 #4
(via Instant C#):
e.Item.ImageUrl = ((SiteMapNode)e.Item.DataItem)["ImageUrl"];

--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter
"Jeff" wrote:
Dear reader!

ASP.NET 2.0

How should this line with vb.net code:
e.Item.ImageUrl = CType(e.Item.DataItem, SiteMapNode)("ImageUrl");
be as C#?????

I want to put the code into MenuItemDataBound(object sender, MenuEventArgs
e)
eventhandler.

I came across this vb.net code on the web, but I'm programming in C# so I
need to convert it into C# for to be able to use it

Any suggestions?

Jeff
Feb 23 '07 #5

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

Similar topics

29
by: Armand Karlsen | last post by:
I have a website ( http://www.zen62775.zen.co.uk ) that I made HTML 4.01 Transitional and CSS compliant, and I'm thinking of converting it into XHTML to learn a little about it. Which XHTML variant...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
3
by: Mary | last post by:
Hi, Does anyone know of any software out there that would convert an application written in VBScript to either VB.NET or C#/C++ quite quickly for me, or will I have to re-write the application...
3
by: Parvesh | last post by:
hi, I am using a webservice which Returns the Result in an XML string, The XML response i get i svery cumbersome to parse, But if i could convert it to the Corresponding Class using the...
12
by: Frederik Vanderhaeghe | last post by:
Hi, I have a problem converting text to a double. Why doesn't the code work: If Not (txtdocbedrag.Text = "") Then Select Case ddlBedrag.SelectedIndex Case 0 Case 1
4
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
7
by: Coleen | last post by:
Does anyone have any good detailed information on the conversion process? We are in the process of converting 2 projects from 2003 to 2005 and have some conversion errors that I can not find...
10
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox...
4
by: screamer81 | last post by:
Hello, I've a SDK functions description for a scanner and I try to convert unmanaged DLL C++ functions to c#. I converted all except one of them. This function is getting a struct parameter. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.