做回发时,ASP.NET文本框使用jQuery UI的DatePicker价值迷失 [英] ASP.NET textbox with jQuery UI DatePicker value lost when doing a postback

查看:115
本文介绍了做回发时,ASP.NET文本框使用jQuery UI的DatePicker价值迷失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了在一个ASP.NET TextBox控件使用jQuery UI的DatePicker的应用程序。

控制工作如预期,但我注意到,当你从服务器调用回发(通过提交按钮),输入值获取程序丢失了。

在想,如果大家都有这样的经历?你有哪些措施做prevent呢?

 < ASP:文本框=服务器ID =txtCallsMadeFrom级=场的EnableViewState =真>变种callsMadeFromId ='#&下;%= txtCallsMadeFrom.ClientID%GT;';
jQuery的(callsMadeFromId).datepicker({showOn:按钮,按钮画面:../images/calendar.gif,altFormat:DD / MM / YY',buttonImageOnly:真的,ONSELECT:功能(){}}) ;


解决方案

您可以考虑在一个隐藏字段保存文本框的值。我这样做,与jQuery作为的TabControls他们也忘记是哪个标签回发过程中选择。

I've got an application that uses jQuery UI DatePicker on an ASP.NET textbox control.

The control is working as intended, but I've noticed that when you postback from a server call (via submit button), the entered value gets lost in the application.

Was wondering if you all have experienced this? What measures that you have to do to prevent this?

<asp:TextBox runat="server" ID="txtCallsMadeFrom" class="field" EnableViewState="true">

var callsMadeFromId = '#<%=txtCallsMadeFrom.ClientID %>';
jQuery(callsMadeFromId).datepicker({ showOn: "button", buttonImage: "../images/calendar.gif", altFormat: 'dd/mm/yy', buttonImageOnly: true, onSelect: function () { } });

解决方案

You could consider saving the Textbox's value in a hidden field. I do that with Jquery tabcontrols as they also forget which tab is selected during a postback.

这篇关于做回发时,ASP.NET文本框使用jQuery UI的DatePicker价值迷失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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