0

It used to work but when I included a jquery-ui tab. It suddenly had an error in it .. So here's how I call it

Dim strCallScript As String = "$(function() { " & _
        "$('#dialog').dialog('open'); " & _
        "});  "
        ClientScript.RegisterStartupScript(Page.GetType(), "error", strCallScript, True)

And here is it's function

 $(function myFunction(){ 
            $( "#dialog" ).dialog({ 
                autoOpen: false,
                modal: true,
                buttons: {
                    OK: function() {
                        $(this).dialog("close");
                    }
                } 
            });                                                
        });           

And here is its div

<div id="dialog" title="Invalid Date Range" class="ui-dialog ui-widget ui-widget-content ui-corner-all"> 
                    <div class="ui-widget">
                        <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
                            <p>
                                <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
                                Please enter starting date.
                            </p>
                        </div>
                    </div> 
                </div>   

And here is the error:

enter image description here

Please help. Thanks :)

Ley47
  • 123
  • 1
  • 4
  • 14
  • 1
    why not inserting the javascript into the asp pages rather than code behind? – Jeff Bootsholz Feb 15 '13 at 06:46
  • I have a condition before it must appear. For it is enclosed in an if statement sorry I was not able to say that – Ley47 Feb 15 '13 at 06:47
  • 1
    In Dim ....you missed :"javascript:myFunction();" For more you may refer to http://stackoverflow.com/questions/788330/passing-arguments-to-javascript-function-from-code-behind – Jeff Bootsholz Feb 15 '13 at 06:57

1 Answers1

0

This was my mistake :)

Dim strCallScript As String = "$(function myFunction(){ " & _
        "$(function() { " & _
        "$('#dialog').dialog('open'); " & _
        "});  " & _
        "});  "

    ClientScript.RegisterStartupScript(Page.GetType(), "error", strCallScript, True)

That was how it was supposed to be

Ley47
  • 123
  • 1
  • 4
  • 14