473,413 Members | 1,789 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,413 software developers and data experts.

Web Form acts differently when using C# than VB

I have a sample web form in C# that works correctly.
When I translated it to VB I can't get one feature in it working.
==============================================
The part that does not work in VB is:
<%= Context.Items["SomeKey"] %>
and:
<%= this.SomeProperty %>

==============================================
Part of the C# HTML code looks like this:
<HTML>
<HEAD>
<title>
<%= Context.Items["SomeKey"] %>
</title>
<%= this.SomeProperty %>
</HEAD>

==============================================
Part of the VB HTML code looks like this:
<HTML>
<HEAD id="Head" runat="server">
<title>
<%= Context.Items("SomeKey") %>
</title>
<%= Me.SomeProperty %>
</HEAD>

==============================================

When I remove the <% %> type of code from the HTML my page runs correctly.
But I get a blank page when I leave it in.

Any ideas?

--
Joe Fallon


Nov 18 '05 #1
1 915
I don't think the language itself is the problem. I also don't see an error
with your code. However, two things come to mind:
1. In your translation, you didn't correctly assign "SomeKey" to
Context.Items. I always recommend using this form of adding to a collection:
Context.Items.Add("name", value)
over
Context.Items("name") = value

2. The value of "SomeKey" is not a string. It must be converted to a string.
Use "Context.Items("SomeKey").ToString()"

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a sample web form in C# that works correctly.
When I translated it to VB I can't get one feature in it working.
==============================================
The part that does not work in VB is:
<%= Context.Items["SomeKey"] %>
and:
<%= this.SomeProperty %>

==============================================
Part of the C# HTML code looks like this:
<HTML>
<HEAD>
<title>
<%= Context.Items["SomeKey"] %>
</title>
<%= this.SomeProperty %>
</HEAD>

==============================================
Part of the VB HTML code looks like this:
<HTML>
<HEAD id="Head" runat="server">
<title>
<%= Context.Items("SomeKey") %>
</title>
<%= Me.SomeProperty %>
</HEAD>

==============================================

When I remove the <% %> type of code from the HTML my page runs correctly.
But I get a blank page when I leave it in.

Any ideas?

--
Joe Fallon

Nov 18 '05 #2

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

Similar topics

0
by: Shyguy | last post by:
I have two forms that both open the same (3rd) form. The third form does the same thing, but a little differently depending on which form it is opened from. Is there a way I can check which form...
9
by: Shyguy | last post by:
I have two forms that both open the same (3rd) form. The third form does the same thing, but a little differently depending on which form it is opened from. Is there a way I can check which form...
17
by: Barret Bonden | last post by:
As an old programmer just now looking at VB.net I have a question: How does one simply open one form from another ? I don't mean how does one create a new instance of that form , but rather how...
2
by: Jim | last post by:
Hello, I need a program that will traverse a directory tree to ensure that there are unix-style line endings on every file in that tree that is a text file. To tell text files from others I...
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
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
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
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...

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.