Execute JavaScript from ASP.NET Server on Page Load

I need to call the following code to render a combox box using JQuery's UI library: //renders combobox element with JQueryUI library function renderComboBox() { $("#combobox").combobox(); } I can execute it just fine when I include the following js in the header: //when doc is ready calls into function to render combobox $(function() { renderComboBox(); }); However, based on conditions available at load time, I either need to decide to run or not run the code. I'd like to do that with something similar to the following: Private Sub Page1_Load(sender As Object, e As EventArgs) Handles Me.Load If .... Then ClientScript.RegisterStartupScript(Me.GetType, _ "RenderCombo", "renderComboBox();", True) End If End Sub But it doesn't seem to be working. Any thoughts? *Update*: [Here's](http://jsfiddle.net/KyleMit/DaBke/4/) a jsFiddle to demonstrate what I'm trying to do, but it's not super helpful because it doesn't help run through any of the ASP.NET specific code.

以上就是Execute JavaScript from ASP.NET Server on Page Load的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏