INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jquery Dialog box

Jquery Dialog box

(OP)
I have a .net page.

From code behind I am calling some jquery dialog boxes like:

CODE

If A = B Then

ScriptManager.RegisterClientScriptBlock(Me, [GetType](), "A", "success();", True)

Else

 ScriptManager.RegisterClientScriptBlock(Me, [GetType](), "B", "invalidclientcode();", True)

End If 

My dialog boxes appear but they all appear one after the other. How do I solve this

Here is my dialog box code:

CODE

<div id="dialog-sucessmessage" title="Message saved">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Your message has been saved
</p>
</div>


<div id="dialog-invalidclientcode" title="Invalid Client Code">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Invalid Client Code retrieved. Only certain client codes are allowed.
</p>
</div> 

RE: Jquery Dialog box

Where are the two functions success() and invalid client code()? And the code that creates the dialogs?

RE: Jquery Dialog box

(OP)
The functions are in the head tag and the dialog code is in the body tag

RE: Jquery Dialog box

I meant that you would need to post them here for us to be able to point out where you are going wrong. Or point us to a page where we can see the issue in action.

RE: Jquery Dialog box

(OP)
Sorry.

Code for the dialog boxes was in a previous post

CODE

<div id="dialog-sucessmessage" title="Message saved">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Your message has been saved
</p>
</div>


<div id="dialog-invalidclientcode" title="Invalid Client Code">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
Invalid Client Code retrieved. Only certain client codes are allowed.
</p>
</div> 

Javascript for the boxes

CODE

<script>
         $(function success() {
             $("#dialog-sucessmessage").dialog({
                 modal: false,
                 autoload: false,
                 buttons: {
                     Ok: function () {
                         $(this).dialog("close");
                     }
                 }
             });
         });
    </script>

    <script>
        $(function invalidclientcode() {
            $("#dialog-invalidclientcode").dialog({
                modal: false,
                autoload: false,
                buttons: {
                    Ok: function () {
                        $(this).dialog("close");
                    }
                }
            });
        });
    </script> 

RE: Jquery Dialog box

(OP)
That's great. Thanks

But I need to call these actions from one button.

At the moment I am using (in code behind)

CODE

If A = B Then

ScriptManager.RegisterClientScriptBlock(Me, [GetType](), "A", "success();", True)

Else

 ScriptManager.RegisterClientScriptBlock(Me, [GetType](), "B", "invalidclientcode();", True)

End If 

RE: Jquery Dialog box

(OP)
Also when I add your code to my page, the dialog boxes are appearing as text without the styling

RE: Jquery Dialog box

remember that you need to load the jquery UI css and you need to specify inline or in your stylesheet that the dialogs are set to display:none.

the buttons are just to show you how it works. your client side code can call success() or the opposite as it wants. of course this must be done client side, not server side. if you want it to be serverside then there is no point in spawning both dialogs. just output what you want and set the autoOpen to true. no need to call success() or whatever. but typically this type of UI is best ajaxed.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close