客户端设置隐藏字段值和隐藏字段值如何在服务器端使用 [英] client side set hiddenfield value and that hiddenfield value how to use in server side

查看:94
本文介绍了客户端设置隐藏字段值和隐藏字段值如何在服务器端使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谢谢先进



客户端设置隐藏字段值和隐藏字段值如何在服务器端使用

解决方案

我不明白你在哪里遇到问题但这应该可以正常工作:

请注意我使用的是jQuery语法,因为你在问题中标记了jQuery。

 <   asp:HiddenField     ID   =  HiddenField1     runat   = < span class =code-keyword> server    /  >  
< script 类型 = text / javascript >


(document).ready(function(){

< br>

(#<% = HiddenField1.ClientID %> )。 VAL( 的NewValue);
});
< / script >





在后面的代码中,你可以通过它的id来访问控件,如下所示:

< pre lang =c#> string hiddenFieldValue = HiddenField1.Value;





希望有所帮助!


Thanks in advanced

client side set hiddenfield value and that hiddenfield value how to use in server side

解决方案

I do not understand where you are having issue but this should just work fine:
Note that I am using jQuery syntax as you have tagged jQuery in the question.

<asp:HiddenField ID="HiddenField1" runat="server" />
<script type="text/javascript">


(document).ready(function () {


("#<%=HiddenField1.ClientID %>").val("NewValue"); }); </script>



In the code behind, you can access the control by it's id like below:

string hiddenFieldValue = HiddenField1.Value;



Hope that helps!


这篇关于客户端设置隐藏字段值和隐藏字段值如何在服务器端使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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