This is a migrated thread and some comments may be shown as answers.

RadWindow IDs change/unable to use $find()

3 Answers 130 Views
Window
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 05 Dec 2007, 03:21 PM

We have started using the new Prometheus RadWindow and have since gotten rid of the Window Manager since it's no longer needed. We've placed them in our master page so they are accessible anywhere. We include a javascript file on every page that allows us to call our own "OpenRadWindow" function, pass in some parameters and it will display as we want it to. In the old version of the RadWindow, we would just get the WindowManager and select the window we wanted. Now, we are using $find in our "OpenRadWindow" function. The downside to this is that the ID doesn't stay the same. On our local machines the following code works just fine to get the RadWindow:

$find("ctl00_WdwClose"
However, on the server, the ID is now "_ctl0_WdwClose". Is there a workaround to get the window in another way without using the rad window manager. We are unable to use server include tags to output the ID because server includes aren't usable in the included javascript file. We are running Vista on our local machines and Windows Server 2003 on the server. The code is identical in both locations.

3 Answers, 1 is accepted

Sort by
0
Matthew Bishop
Top achievements
Rank 1
answered on 06 Dec 2007, 01:48 AM
Adam, I think what you are saying is the same as a problem I had, whilst this is a bit of a hack, this is what I do.
On the server side I have this code (in c#):
Response.Write("<script>hackRadWindowID='"+RadWindow1.ClientID+"';</script>");

Then I can get the id by:
$find(hackRadWindowID);

Hope this helps :)
0
Adam
Top achievements
Rank 1
answered on 06 Dec 2007, 02:03 PM
That works great! Kind of seems stupid to have to do that, but I'm not all that surprised with the way the ASP.NET handles it.

I had to use ClientScript.RegisterStartupScript to output the script, otherwise it would mess up the styles on my page for some reason. Luckily with them being in a master page, I only have to make this change once.

Thanks again,
Adam
0
Tervel
Telerik team
answered on 06 Dec 2007, 02:34 PM
Hi Adam,

As you point out yourself,  this is how ASP.NET works and you would face the same situation with any serverside control that you try to get a reference to on the client side.

To get such a reference, one would need to use the same [or a variation of] the approach provided by Matthew.

Kind regards,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Adam
Top achievements
Rank 1
Answers by
Matthew Bishop
Top achievements
Rank 1
Adam
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or