如何在.aspx页的客户端中获取标签控件的值 [英] How to get Value of Lable control in Client Side of .aspx Page

查看:79
本文介绍了如何在.aspx页的客户端中获取标签控件的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生
我正在获取TextBox的Value,它工作正常...

Dear Sir
I am using to get Value of TextBox, it is working fine ...

var ID=document.getElementById("<%=txtipdregno.ClientID%>").value;


但是对于Lable,它不起作用,请对其进行修改.
也可以在Visible ="False"条件下获取Value吗?


But for Lable it is not working, Please modify it.
Also is it possible to get Value in Visible="False" condition ?

推荐答案

否,当您在ASPX页面中设置Visible = False时,.Net不会呈现完全没有控件,因此您无法在客户端获得它.如果需要访问隐藏"控件客户端,则必须使用style ="visibility:hidden",以便控件位于客户端.
No, when you set Visible=False in the ASPX page, .Net does not render the control at all so you cannot get it on the client side. If you need to access a "hidden" control client side you have to use style="visibility: hidden" instead so that the control is on the client side.


var ID = document. getElementById(<%= LblID.ClientID%>").innerHTML;
var ID=document.getElementById("<%=LblID.ClientID%>").innerHTML;


这篇关于如何在.aspx页的客户端中获取标签控件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆