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 FallonI 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: PLBlum@.PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Joe Fallon" <jfallon1@.nospamtwcny.rr.com> wrote in message
news:%23AVorb28DHA.2760@.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
>
Monday, March 12, 2012
Web Form acts differently when using C# than VB
Labels:
acts,
asp,
correctly,
differently,
feature,
form,
net,
sample,
translated,
web
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment