Try:
$mydiv = $("#mydiv");
$mydiv.data("title.dialog", $("title", $mydiv).text());
The problem with loading aspx pages into the dom is that you get all
the page overhead (headings, forms, aspx stuff). I have found that it
is much better to use ashx pages and just return data or raw html.
If the above code does not do the trick, you could try putting the
title into a hidden input box and then get it from there.
<asp:HiddenField ID="hidTitle" runat="server" Value="Title Goes Here
or can be set dynamically in aspx code" />
Then you could set the dialog title like this:
$("#mydiv").data("title.dialog", $("#hidTitle").val());
Hth,
Dave
On Dec 29, 9:32 am, "Andries Snyman" <[email protected]> wrote:
> Will look around a bit, and let you know if I find something.
> Hopefully some one else can help aswell :)
>
> On Mon, Dec 29, 2008 at 4:17 PM, jQDeveloper <[email protected]> wrote:
>
> > I am now able to modify the title of the dialog after opening. The
> > code goes like:
>
> > $(#mydiv").data("title.dialog", "New Title");
>
> > But still my issue remains the same as to how can I set the title of
> > the dialog to the title of the opened page ("WebForm1.aspx" in this
> > case).
>
> > On Dec 29, 6:46 pm, "Andries Snyman" <[email protected]> wrote:
> > > Hmm, are you using firebug to check for errors?
>
> > > Maybe try and change the title before you open the dialog, I know that
> > may
> > > not be what you want, but just for interest.
> > > I don't know if the dialog exposes any properties to do this.
> > > The help pages may be missing some of this info, wish for an update :)
>
> > > On Mon, Dec 29, 2008 at 3:36 PM, jQDeveloper <[email protected]>
> > wrote:
>
> > > > Tried as $("#mydiv1").attr('title','New Title'); but did not help. No
> > > > error either.
>
> > > > On Dec 29, 6:30 pm, "Andries Snyman" <[email protected]> wrote:
> > > > > I wonder if it's caused by importing the js scripts again. May be
> > some of
> > > > > the jquery ppl can help.
>
> > > > > For the title, try to set the $("#mydiv").attr('title') = "New
> > Title";
>
> > > > > Hope this works, never tried it before.
>
> > > > > On Mon, Dec 29, 2008 at 3:14 PM, jQDeveloper <[email protected]>
> > > > wrote:
>
> > > > > > Also can I set the title of the dialog box to title of the
> > > > > > WebForm1.aspx page?
>
> > > > > > On Dec 29, 6:11 pm, jQDeveloper <[email protected]> wrote:
> > > > > > > Bingo. It worked. But can I guess the reason why my previous code
> > was
> > > > > > > not working? But anyways thanks a lot for your help.
>
> > > > > > > On Dec 29, 5:59 pm, "Andries Snyman" <[email protected]> wrote:
>
> > > > > > > > So, if I understand correctly, this page is loaded into the
> > other
> > > > aspx
> > > > > > where
> > > > > > > > you declared the dialog.
>
> > > > > > > > I'm going to edit the whole page, try this:
>
> > > > > > > > <html>
> > > > > > > > <head>
> > > > > > > > <title></title>
> > > > > > > > <script type="text/javascript">
> > > > > > > > function closeDialog() {
> > > > > > > > alert("Coming in closeDialog");
> > > > > > > > $("#mydiv").dialog("close");
> > > > > > > > }
> > > > > > > > </script>
> > > > > > > > </head>
> > > > > > > > <body>
> > > > > > > > <table>
> > > > > > > > <tr>
> > > > > > > > <td><span>Name:</span></td>
> > > > > > > > <td><input type="text" /></td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td><span>Age:</span></td>
> > > > > > > > <td><input type="text" /></td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td><input type="button"
> > value="Ok"
> > > > > > /></td>
> > > > > > > > <td><input type="button"
> > id="cancel"
> > > > > > > > value="Cancel" onclick="javascript:closeDialog()" /></td>
> > > > > > > > </tr>
> > > > > > > > </table>
> > > > > > > > </body>
> > > > > > > > </html>
>
> > > > > > > > Hope this helps :)
>
> > > > > > > > On Mon, Dec 29, 2008 at 2:49 PM, jQDeveloper <
> > [email protected]>
> > > > > > wrote:
>
> > > > > > > > > My WebForm1.aspx page codes looks like:
>
> > > > > > > > > <html>
> > > > > > > > > <head>
> > > > > > > > > <title></title>
> > > > > > > > > <script type="text/javascript"
> > src="Script/jquery-1.2.6.js"></
> > > > > > > > > script>
> > > > > > > > > <script type="text/javascript"
> > > > src="Script/ui.core.js"></script>
> > > > > > > > > <script type="text/javascript"
> > > > src="Script/ui.dialog.js"></script>
> > > > > > > > > <link rel="Stylesheet" media="screen"
> > href="Styles/ui.all.css"
> > > > > > > > > type="text/css" />
> > > > > > > > > <script type="text/javascript">
> > > > > > > > > $(function() {
> > > > > > > > > function closeDialog() {
> > > > > > > > > alert("Coming in closeDialog");
> > > > > > > > > $("#mydiv").dialog("close");
> > > > > > > > > };
>
> > > > > > > > > $("#cancel").click(function() {
> > > > > > > > > alert("Coming");
> > > > > > > > > // $("#dialog").dialog("close");
> > > > > > > > > closeDialog();
> > > > > > > > > });
> > > > > > > > > });
> > > > > > > > > </script>
> > > > > > > > > </head>
> > > > > > > > > <body>
> > > > > > > > > <table>
> > > > > > > > > <tr>
> > > > > > > > > <td><span>Name:</span></td>
> > > > > > > > > <td><input type="text" /></td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td><span>Age:</span></td>
> > > > > > > > > <td><input type="text" /></td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td><input type="button"
> > > > value="Ok"
> > > > > > /></td>
> > > > > > > > > <td><input type="button"
> > > > id="cancel"
> > > > > > > > > value="Cancel" /></td>
> > > > > > > > > </tr>
> > > > > > > > > </table>
> > > > > > > > > </body>
> > > > > > > > > </html>
>
> > > > > > > > > On Dec 29, 5:43 pm, "Andries Snyman" <[email protected]>
> > wrote:
> > > > > > > > > > There might be another problem, if you use visual studio
> > > > developer
> > > > > > to
> > > > > > > > > code
> > > > > > > > > > and create the buttons and other components, I know it will
> > > > > > actually
> > > > > > > > > render
> > > > > > > > > > the IDs of those components with different names. So when
> > > > viewing
> > > > > > the
> > > > > > > > > page
> > > > > > > > > > in the browser, just make sure of this by viewing the page
> > > > source.
>
> > > > > > > > > > On Mon, Dec 29, 2008 at 2:31 PM, jQDeveloper <
> > > > [email protected]
>
> > > > > > > > > wrote:
>
> > > > > > > > > > > Yes. Here goes my code:
>
> > > > > > > > > > > $(function() {
> > > > > > > > > > > $("#cancel").click(function() {
> > > > > > > > > > > $("#mydiv").dialog("close");
> > > > > > > > > > > });
> > > > > > > > > > > });
>
> > > > > > > > > > > On Dec 29, 5:17 pm, "Andries Snyman" <[email protected]
>
> > > > wrote:
> > > > > > > > > > > > Hmm, so you are declaring the click event on the
> > > > document.ready
> > > > > > of
> > > > > > > > > > > > "WebForm1.aspx", correct?
>
> > > > > > > > > > > > Can you try 2 things:
> > > > > > > > > > > > -
>
> > > > > > > > > > > > On Mon, Dec 29, 2008 at 2:08 PM, jQDeveloper <
> > > > > > [email protected]>
> > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > Andries,
>
> > > > > > > > > > > > > I tried to use your way by:
>
> > > > > > > > > > > > > $("#cancel_button_id").click(function() {
> > > > > > > > > > > > > $("#mydiv").dialog("close");
> > > > > > > > > > > > > });
>
> > > > > > > > > > > > > But it didn't work. Any more help.
>
> > > > > > > > > > > > > On Dec 28, 4:18 pm, "Andries Snyman" <
> > [email protected]
>
> > > > > > wrote:
> > > > > > > > > > > > > > Hi,
>
> > > > > > > > > > > > > > Won't it help to have an onClick event with just a
> > > > > > > > > > > > > > <$("#dialog").dialog("close");>?
> > > > > > > > > > > > > > Because even if the WebForm1.aspx is a page on its
> > own,
> > > > > > it's
> > > > > > > > > still
> > > > > > > > > > > loaded
> > > > > > > > > > > > > > into the current page and the same js components
> > still
> > > > > > exist.
> > > > > > > > > > > > > > Kind regars
>
> > > > > > > > > > > > > > On Sat, Dec 27, 2008 at 8:56 AM, jQDeveloper <
> > > > > > > > > [email protected]>
> > > > > > > > > > > > > wrote:
>
> > > > > > > > > > > > > > > Hi All,
>
> > > > > > > > > > > > > > > I was trying to replace my window.open() code
> > with
> > > > the
> > > > > > jQuery
> > > > > > > > > > > Dialog
> > > > > > > > > > > > > > > box. Now here is my code:
>
> > > > > > > > > > > > > > > $(function() {
> > > > > > > > > > > > > > > $("<div
> > > > > > id='mydiv'></div>").load("WebForm1.aspx").dialog();
> > > > > > > > > > > > > > > });
>
> > > > > > > > > > > > > > > WebForm1.aspx has Ok and Cancel buttons. I want
> > to
> > > > close
> > > > > > my
> > > > > > > > > Dialog
> > > > > > > > > > > box
> > > > > > > > > > > > > > > when I click on Cancel from WebFrom1.aspx. Can
> > anyone
> > > > > > tell me
> > > > > > > > > how
> > > > > > > > > > > to
> > > > > > > > > > > > > > > do it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---