tags:

views:

242

answers:

3

does anyone know how to use jquery modal dialog in asp.net pages? http://jqueryui.com/demos/dialog/

I've tried creating a simple aspx page, pasted code from the example (http://jqueryui.com/demos/dialog/), it almost works. The dialog briefly shows up and then disappears. It seems that the page is doing a postback. I'm not sure how to stop it, so that the modal dialog stays up.

A: 

I assume you have something like:

<asp:Button ID="popupButton" OnClientClick="showModalPopup();" Text="Click me" runat="server" />

I would try adding "return false;" to the OnClientClick property of your Button:

<asp:Button ID="popupButton" OnClientClick="showModalPopup(); return false;" Text="Click me" runat="server" />

Or if you don't need to access the button in code-behind, simply use a standard HTML button and set it's onclick event attribute:

<button onclick="showModalPopup();">Click me</button>
Cory Larson
A: 

thank you, I will try that out. The way I tried it last night was with simple, , not an asp.ne button. what that make a difference?

ra170
Hi, please don't post your comments as a new answer, as it will get reordered once there are votes assigned to an answer. Unfortunately you'll need more reputation to be able to comment on an existing answer.
Martin C.
A: 

I've been using jqModal for modal dialogs. I've set it up to use a standard HTML input button to trigger the dialog, and then you can put a regular asp.net button or other controls inside of the hidden div.

Hope this helps.

Shea Daniels