DatePicker的回传后消失 [英] DatePicker disappears after postback

查看:208
本文介绍了DatePicker的回传后消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp:关联到一个jQuery的DatePicker文本框。该输入具有onTextChangedEvent,更新文字控制。

I have an asp:TextBox associated to a jquery DatePicker. This input has a onTextChangedEvent that updates a Literal Control.

这一切code是一个UpdatePanel所以文本控件里面的变化,但也不会刷新页面。

All this code is inside an UpdatePanel so the Literal Control changes but the page doesn't refresh.

我现在面临的问题是,当事件触发时,显示的DatePicker的图像消失。这里是我的一块code的:

The problem I'm facing is that when the event fires, the image that displays the DatePicker disappears. Here's a piece of my code:

<asp:UpdatePanel ID="UpdatePanel" runat="server">
    <ContentTemplate>

        <asp:TextBox runat="server" OnTextChanged="EditFromDate_TextChanged"
        AutoPostBack="true"></asp:TextBox>

    </ContentTemplate>
 </asp:UpdatePanel>

然后我有:

$(document).ready(function()
{
    $("#EditFromDate").datepicker({ ... });
});

我应该把code其他地方发起的DatePicker?
我试着用Page.RegisterStartup但同样的结果将其放置在页面加载。

Should I put the code that initiates the DatePicker elsewhere? I've tried placing it in Page Load using Page.RegisterStartup but same result.

谢谢!

推荐答案

使用页面加载,它触发对部分回发:

Use pageLoad, it fires on partial postbacks:

   function pageLoad() { 
      $("#EditFromDate").datepicker({ ... });

   } 

$(文件)。就绪()和页面加载()是不一样的!

这篇关于DatePicker的回传后消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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