开发者

append script text into the end of an asp.net web form page from user control

here is what I am doing from user control code behind;

开发者_Go百科    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), 
   "JQuerySearchReminder",
    string.Format("(function() {{ $(function(){{ $('#{0}').val('{1}'); }}); }})();", ddlDestinationTrf.ClientID, srchrmdr["_did"]), 
    true);

the script code works fine, nothing wrong there. On the user control I am also using AjaxControlToolkit's CascadingDropDown control.

So the problem is that;

this c# code I am using to append the script into page is registered before the CascadingDropDown control's script code. this isn't work in this situation Because the dorpdownlist is empty if CascadingDropDown control hasn't done the job.

So guys, let me escape from this lame situation.


Have you tried setting ScriptManager.LoadScriptsBeforeUI to false. See here for details.

Alternatively, couldn't you use jquery's document.ready function to run your javascript code after the document was loaded?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜