C#: Label contains no text
<p>I would like to get the text out of a label. But the label text is set with Javascript.
On the page I can see that there is text in the label, but when I debug it shows this: "".</p>

<p>So how do I get the text out of a label that is set with Javascript, at least that is what I think is the problem.</p>

<p>My code:</p>

<pre><code>&lt;asp:TextBox ID="txtCount" runat="server" Width="50px" Font-Names="Georgia, Arial, sans-Serif" ForeColor="#444444"&gt;&lt;/asp:TextBox&gt;
&lt;ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" Minimum="1"
 TargetButtonDownID="btnDown" TargetButtonUpID="btnUp" TargetControlID="txtCount"  Width="20" /&gt;
&lt;asp:ImageButton ID="btnUp" runat="server" AlternateText="up" ImageUrl="Images/arrowUp.png"
 OnClientClick="setAmountUp()" ImageAlign="Top" CausesValidation="False" /&gt;
 &lt;asp:ImageButton ID="btnDown" runat="server" AlternateText="down" ImageUrl="Images/arrowDown.png"  OnClientClick="setAmountDown()" ImageAlign="Bottom" 
 CausesValidation="False" /&gt;

&lt;asp:Label ID="lblKorting" runat="server" /&gt;

 &lt;asp:Label ID="lblAmount" runat="server" /&gt;

&lt;asp:Button ID="btnBestel" runat="server" CssClass="btn" Text="Bestel" OnClick="btnBestel_Click1" /&gt;
</code></pre>

<p>JS</p>

<pre><code>function setAmountUp()
{
    var aantal = document.getElementById('&lt;%=txtCount.ClientID%&gt;').value-0;

    aantal+=1;
    calculateAmount(aantal);
}

function setAmountDown()
{
    var aantal = document.getElementById('&lt;%=txtCount.ClientID%&gt;').value-0;

    if(aantal &gt; 1)
        aantal -=1;

    calculateAmount(aantal);
}

function calculateAmount(aantal)
{

    var prijs = document.getElementById('&lt;%=lblPriceBestel.ClientID%&gt;').innerHTML -0;   
    var totaal = 0;

    if(aantal &lt; 2)
    {
        totaal = prijs * aantal;
        document.getElementById('&lt;%=lblKorting.ClientID%&gt;').innerHTML = "";
    }

    else if(aantal &gt;= 2 &amp;&amp; aantal &lt; 5)
    {
        totaal = (prijs * aantal)*0.95;
        document.getElementById('&lt;%=lblKorting.ClientID%&gt;').innerHTML = "-5%";
    }

    else if(aantal &gt;= 5)
    {
        totaal = (prijs * aantal)*0.90;
        document.getElementById('&lt;%=lblKorting.ClientID%&gt;').innerHTML = "-10%";
    }

    document.getElementById('&lt;%=lblAmount.ClientID%&gt;').innerHTML = totaal;
}
</code></pre>

<p>C#</p>

<pre><code> private OrderBO bestelling;
    protected void btnBestel_Click1(object sender, EventArgs e)
    {
        bestelling = new OrderBO();
        bestelling.Amount = Convert.ToInt32(lblAmount.Text); //&lt;--- THIS IS "" in the debugger, but on the page 10
    }
</code></pre>
