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

RadWindow is null in Javascript-Function

1 Answer 181 Views
Window
This is a migrated thread and some comments may be shown as answers.
Daniela
Top achievements
Rank 1
Daniela asked on 10 Nov 2010, 09:23 PM
if I want to open a RadWindow the window is zero. I should have read the one by the javascript "Page.ClientScript.RegisterStartupScript" embed but that does not work.

what must I do to the window to open with javascript? The call must remain in the method.


RadWindow:
<telerik:RadWindow ID="RadWindowInformation" EnableShadow="true" Behaviors="Close, Move" runat="server">
  <ContentTemplate>
    <div class="window">
      <div class="window_l">
        <div ID="WindowIcon" runat="server"></div>
      </div>
      <div class="window_r">
        <asp:Literal ID="UserMessage" runat="server"></asp:Literal>
      </div>
      <div class="clear window_button">
        <asp:Button ID="Button" runat="server" Text="OK" />
      </div>
    </div>
  </ContentTemplate>
</telerik:RadWindow>

C#-Code:
public void ShowInformation(WebExtensions.PageControlling.InformationObject information)
 {
  StringBuilder radWindowInfoScript = new StringBuilder(); 
   radWindowInfoScript.Append("openWindow();");
   radWindowInfoScript.Append("function openWindow()");
   radWindowInfoScript.Append("{");
   radWindowInfoScript.Append("var oWindow = $find(\"" + RadWindowInformation.ClientID + "\");");
   radWindowInfoScript.Append("oWindow.setSize(400, 400);");
   radWindowInfoScript.Append("oWindow.center();");
   radWindowInfoScript.Append("oWindow.open();");
   radWindowInfoScript.Append("}");
   Page.ClientScript.RegisterStartupScript(this.GetType(), "openWindow", radWindowInfoScript.ToString(), true);

Greetings Dani

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 16 Nov 2010, 09:15 AM
Hello Dani,

Page.ClientScript.RegisterStartupScript() will put the JavaScript function just before the closing </form> tag and basically, the code will be executed in window.onload. As noted in the blog post that I assume you are referring to, all ASP.NET AJAX controls are loaded on a later stage. That is why in the sample code that uses RegisterStartupScript, we are calling the JavaScript code in Sys.Application.Load.
Please check the samples in the blog post and choose the one that fits your scenario most. If you still experience problems, I would suggest to open a support ticket and send me a sample project that reproduces your setup. I will check it and get back to you with the most appropriate solution.



Best wishes,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Window
Asked by
Daniela
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or