通过jQuery属性 - 如何填补Label.Text [英] How to fill a Label.Text - Property via jQuery

查看:111
本文介绍了通过jQuery属性 - 如何填补Label.Text的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET和有我的页面上的标签控件,我充满了
jQuery的命令

I use ASP.NET and have a label control on my page, which I fill with the jQuery-Command

$('#<%= myLabel.ClientID %>').html(content);

.VAL()似乎并没有与此有关的工作。

.val() does not seem to work with this.

不知怎的,我有一个获得在code-后面的内容问题。在code时,myLabel.Text-物业仍然是空的。

Somehow, I have Problems getting the content in code-behind. In the code, the myLabel.Text-Property is still empty.

推荐答案

如果你想显示客户端上的价值并使其可在页面上,你需要会得到送往code。将输入-behind当您发布这样的:

If you want to display the value on the client and have it available on the page, you need an input that'll get sent to the code-behind when you POST like this:

$('#<%= myLabel.ClientID %>').html(content);
$('#<%= myInput.ClientID %>').val(content);

<asp:Label Id="myLabel" runat="server" />
<asp:HiddenField ID="myInput" runat="server" />

在code-背后:

myInput.Value

这篇关于通过jQuery属性 - 如何填补Label.Text的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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