如何访问服务器中的函数输出(在javascript中) [英] How to access output of a function (in javascript) in server
问题描述
嗨
我搜索但找不到正确的解决方案。
我创建一个usercontrol并在页面中添加3个实例。
在usercontrol中创建
a函数并指定标签的vaue
但是当我运行此页面时,usercontrol没有显示这个标签。
这是我的代码
function createResult(){
document .getElementById(' <%= lbResult.ClientID%> ;')。innerText = ' NEWVALUE';
}
< asp:标签 ID = lbPlace runat = server CssClass = Orng_Font_Color > < / asp:Label >
出了什么问题?
我尝试过:
访问服务器端javascript函数的输出。
Hi
I search but not found right solution. 这篇关于如何访问服务器中的函数输出(在javascript中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
I create a usercontrol and add 3 instance of it in a page.
a function created in usercontrol and specify vaue of a label
but when i run this page,usercontrol not shown this lable.
this is my code
function createResult() {
document.getElementById('<%=lbResult.ClientID %>').innerText='NEWVALUE';
}
<asp:Label ID="lbPlace" runat="server" CssClass="Orng_Font_Color"></asp:Label>
what is wrong?
What I have tried:
access to output of a javascript function in server side.Labels are rendered as span elements which are not included in form postbacks so if you change the value client-side that change won't be persisted. Put an asp:Hidden field on the page also and update the hidden field as well as the label, and the hidden field will be included in the postback and you can read that value in your server code.