vb.net code is not running on asp.net page
up vote
-2
down vote
favorite
I wanted to make a simple asp.net example page with just shows "Hello, World!" and current time.
but it shows only "Hello, world!", not time. This is my code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
This is a test
</title>
<script language="VB" runat="server">
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblMessage.Text = DateTime.Now.ToString()
End Sub
</script>
</head>
<body>
<p> Hello, World! </p>
<asp Labelid="lblMessage" runat="server" />
</body>
</html>
Why does this happen and what's cure for it?
asp.net vb.net
add a comment |
up vote
-2
down vote
favorite
I wanted to make a simple asp.net example page with just shows "Hello, World!" and current time.
but it shows only "Hello, world!", not time. This is my code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
This is a test
</title>
<script language="VB" runat="server">
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblMessage.Text = DateTime.Now.ToString()
End Sub
</script>
</head>
<body>
<p> Hello, World! </p>
<asp Labelid="lblMessage" runat="server" />
</body>
</html>
Why does this happen and what's cure for it?
asp.net vb.net
1
What type of file is this (what is its extension)? Plain .html or .aspx (it should be the latter)?
– Hans Kesting
Nov 10 at 15:49
Check 2: in your browser, do a "view source". You shouldn't see the "runat=server" parts
– Hans Kesting
Nov 10 at 15:50
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I wanted to make a simple asp.net example page with just shows "Hello, World!" and current time.
but it shows only "Hello, world!", not time. This is my code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
This is a test
</title>
<script language="VB" runat="server">
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblMessage.Text = DateTime.Now.ToString()
End Sub
</script>
</head>
<body>
<p> Hello, World! </p>
<asp Labelid="lblMessage" runat="server" />
</body>
</html>
Why does this happen and what's cure for it?
asp.net vb.net
I wanted to make a simple asp.net example page with just shows "Hello, World!" and current time.
but it shows only "Hello, world!", not time. This is my code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
This is a test
</title>
<script language="VB" runat="server">
Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblMessage.Text = DateTime.Now.ToString()
End Sub
</script>
</head>
<body>
<p> Hello, World! </p>
<asp Labelid="lblMessage" runat="server" />
</body>
</html>
Why does this happen and what's cure for it?
asp.net vb.net
asp.net vb.net
edited Nov 10 at 7:43
asked Nov 10 at 5:32
user8410267
12
12
1
What type of file is this (what is its extension)? Plain .html or .aspx (it should be the latter)?
– Hans Kesting
Nov 10 at 15:49
Check 2: in your browser, do a "view source". You shouldn't see the "runat=server" parts
– Hans Kesting
Nov 10 at 15:50
add a comment |
1
What type of file is this (what is its extension)? Plain .html or .aspx (it should be the latter)?
– Hans Kesting
Nov 10 at 15:49
Check 2: in your browser, do a "view source". You shouldn't see the "runat=server" parts
– Hans Kesting
Nov 10 at 15:50
1
1
What type of file is this (what is its extension)? Plain .html or .aspx (it should be the latter)?
– Hans Kesting
Nov 10 at 15:49
What type of file is this (what is its extension)? Plain .html or .aspx (it should be the latter)?
– Hans Kesting
Nov 10 at 15:49
Check 2: in your browser, do a "view source". You shouldn't see the "runat=server" parts
– Hans Kesting
Nov 10 at 15:50
Check 2: in your browser, do a "view source". You shouldn't see the "runat=server" parts
– Hans Kesting
Nov 10 at 15:50
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
The issue is probably the malformation of the label.
Not sure why you're using a label here in the first place (typically they're used for labeling form inputs)
<asp Labelid="lblMessage" runat="server" />
Should be
<asp:Label id="lblMessage" runat="server" />
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
The issue is probably the malformation of the label.
Not sure why you're using a label here in the first place (typically they're used for labeling form inputs)
<asp Labelid="lblMessage" runat="server" />
Should be
<asp:Label id="lblMessage" runat="server" />
add a comment |
up vote
2
down vote
The issue is probably the malformation of the label.
Not sure why you're using a label here in the first place (typically they're used for labeling form inputs)
<asp Labelid="lblMessage" runat="server" />
Should be
<asp:Label id="lblMessage" runat="server" />
add a comment |
up vote
2
down vote
up vote
2
down vote
The issue is probably the malformation of the label.
Not sure why you're using a label here in the first place (typically they're used for labeling form inputs)
<asp Labelid="lblMessage" runat="server" />
Should be
<asp:Label id="lblMessage" runat="server" />
The issue is probably the malformation of the label.
Not sure why you're using a label here in the first place (typically they're used for labeling form inputs)
<asp Labelid="lblMessage" runat="server" />
Should be
<asp:Label id="lblMessage" runat="server" />
answered Nov 10 at 15:23
Nathan Champion
2269
2269
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236274%2fvb-net-code-is-not-running-on-asp-net-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What type of file is this (what is its extension)? Plain .html or .aspx (it should be the latter)?
– Hans Kesting
Nov 10 at 15:49
Check 2: in your browser, do a "view source". You shouldn't see the "runat=server" parts
– Hans Kesting
Nov 10 at 15:50