0

I would like to get value from label with id=lblValue. On page confirm I see confirmed HTML as:

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

All I need is to get value from lblValue. Is there a way to get this value? Values will range from -10 to 0. In the example above, value=0. I am doing this on the server side, not on the client side.

FrenkyB
  • 6,625
  • 14
  • 67
  • 114

2 Answers2

0
<script type="javascript">
document.getElementById("lblValue").innerHTML
</script>
Javi Zhu
  • 68
  • 8
0

Add runat="server" attribute like this:

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

and you will be able to use lblValue as a variable.

For more information, what runat attribute is doing, please see this: Why does ASP.NET webforms need the Runat="Server" attribute?

Community
  • 1
  • 1
Vano Maisuradze
  • 5,829
  • 6
  • 45
  • 73