c#
  • asp.net
  • 2017-03-21 17 views 0 likes 
    0

    labelから値を取得したいと考えています。id=lblValueです。私は必要なすべてがlblValueから値を取得することです確認済みのHTMLからAspx値を取得

    <span class="treeColorOrderBefPrepare">~ 
    <div style='display:inline-block;'> 
    <img onclick='calculateDate.add(this);' style='cursor:pointer;' class="imageInBox" src="/_assets/images/icons/small/add.png"/> 
    <img onclick='calculateDate.subtract(this);' style='margin-left:3px;cursor:pointer;' class="imageInBox" src="/_assets/images/icons/small/subtract.png"/> 
    <label id='lblValue' style='position:relative;top:1px;width: 13px; height: 13px;margin-left:3px;margin-right:3px;'>0</label> 
    </div>&nbsp; 
    <img class="imageInBox" src="/_assets/images/icons/small/icon-small-merchandise.png"/>POPER ČRNI MLETI (0,0 KG) (fina. HKJ_TK, predp. Cent.predp: 04.04.2017 - 0,0 KG)</span>&nbsp; 
    <input type="text" name="DK_m_1_3_120000204_140000240-120003917-120000204-" value=""> 
    

    :ページの確認に私はとしてHTMLを確認参照してください。この価値を得る方法はありますか?値の範囲は-10から0です。上記の例では、value = 0です。私はクライアント側ではなく、サーバー側でこれをやっています。

    答えて

    0
    <script type="javascript"> 
    document.getElementById("lblValue").innerHTML 
    </script> 
    
    +0

    私は、サーバー側では、この値を取得したいと思います。 – FrenkyB

    +0

    runat = "server" –

    0

    にrunat = "サーバー"このような属性を追加します。

    <label id='lblValue' runat="server" style='position:relative; 
    top:1px;width: 13px; height: 13px; margin-left:3px;margin-right:3px;'>0</label> 
    

    を、あなたが変数としてlblValueを使用することができます。

    詳細については、やっているにrunat何属性、これを参照してください。Why does ASP.NET webforms need the Runat="Server" attribute?

    関連する問題