I need to call the following code to render a combox box using JQuery's UI library:
<!-- language: lang-js -->//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:
<!-- language: lang-js -->//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:
<!-- language: lang-vb -->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 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.