ASP.NET的隐藏字段不能设置与jQuery值 [英] Asp .net hidden field can't set value with jquery

查看:104
本文介绍了ASP.NET的隐藏字段不能设置与jQuery值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能在ASP.NET的jQuery的设置隐藏字段的值。

I can't set the value of a hidden field with jquery in asp .net.

我的隐藏字段声明如下:

My hidden field is declared like this:

<asp:HiddenField runat="server" ID="hdnSelectedTicket" />

和我这是怎么设置的值:

And this is how I set the value:

            alert(ticketID);
            $('#<%=hdnSelectedTicket.ClientID %>').val(ticketID);
            alert($('#<%=hdnSelectedTicket.ClientID %>').val());

这两个警报显示正确的价值,但是当我在服务器上获取它,它是空的。

Both alerts show the right value but when I fetch it at the server it is empty.

推荐答案

原来,我是把隐藏字段被用来作为jQuery的对话模型的DIV中。当我从分区删除隐藏字段,并放置在别处它的工作。

It turns out that I was putting the hidden field inside a div that was used as a model for jquery dialog. When I removed the hidden field from the div and place it somewhere else it worked.

这篇关于ASP.NET的隐藏字段不能设置与jQuery值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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