Tag: registerstartupscript

RegisterStartupScript似乎不在更新面板中的页面回发上工作

好的 – 所以我正在使用一个使用自定义datepicker控件的系统(我知道还有其他的…但为了一致性,我想了解为什么我的当前问题正在发生并修复它)。 因此,带有文本框和Page_PreRender的自定义用户控件执行此操作: protected void Page_PreRender(object sender, EventArgs e) { string clientScript = @” $(function(){ $(‘#” + this.Date1.ClientID + @”‘).datepicker({dateFormat: ‘dd/mm/yy’, constrainInput: true}); });”; Page.ClientScript.RegisterStartupScript(this.GetType(), this.ClientID, clientScript, true); //Type t = this.GetType(); //if (!Page.ClientScript.IsStartupScriptRegistered(t, this.ClientID)) //{ // Page.ClientScript.RegisterStartupScript(t, this.ClientID, clientScript, true); //} } 忽略注释掉的东西 – 那是我尝试不同的东西 – 没有帮助。 我的问题是,当我加载页面时,这一切都正常。 但是如果我从下拉列表中选择一些导致页面回发的内容 – 当我点击我的日期字段时它们就会停止工作。 就像在我应该能够点击进入文本框并出现一个漂亮的日历控件。 但在回发后,没有出现漂亮的日历控件! […]