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?










share|improve this question



















  • 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














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?










share|improve this question



















  • 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












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?










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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












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" />





share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    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

























    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" />





    share|improve this answer
























      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" />





      share|improve this answer






















        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" />





        share|improve this answer












        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" />






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 at 15:23









        Nathan Champion

        2269




        2269



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kleinkühnau

            Makov (Slowakei)

            Deutsches Schauspielhaus