Valerie Meunier

Valerie Meunier

  • NA
  • 693
  • 82.1k

precedence of execution

Aug 7 2022 2:18 PM

Hi

This code below gives at the end label1 = "via jv". I was expecting label1 = "via code".

So why is it "via jv"? I thought the order of execution was:

1) aspx file with javascript => "via jv"

2) code-behind.=> "via code"

Thanks

 

 <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<script type="text/javascript">
        document.getElementById("Label1").textContent = "via jv";
    </script>
protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = "via code";
        }


Answers (4)