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

Dynamically open a radwindow defined in Javascript

2 Answers 154 Views
Window
This is a migrated thread and some comments may be shown as answers.
Xorv
Top achievements
Rank 2
Xorv asked on 07 Oct 2012, 03:41 PM
Hi guys,

Objective:- From the server-side, I need to open a radwindow(defined in javascipt of the aspx page) automatically on an IF condition.

In aspx page, I defined the radwindow as:-
<telerik:RadWindowManager Skin="WBDA" ID="AssetPreviewManager" Modal="true" 
EnableEmbeddedSkins="false" runat="server"  DestroyOnClose="true" Behavior="Close" 
style="z-index:8000"
     <Windows>  
     <telerik:RadWindow ID="DisclaimerAlertWindow" runat="server" Width="720px" Height="220px" 
Modal="true" visibleStatusbar="false" VisibleTitlebar="false" keepInScreenBounds="true" title="Sourav">                                           
     </telerik:RadWindow
     </Windows
     </telerik:RadWindowManager>

In Javascript, a fucntion is defined for opening the radwindow:-
function openRadWindow()
     {
        var oWnd = radopen('DisclaimerAlert.aspx, 'DisclaimerAlertWindow');
        oWnd.set_title('Access Denied !'); 
        oWnd.Center();
        return false;
     }

So on the server side of the aspx page, In the Page Load event an IF condition is checked and then I'm calling 'openRadWindow()' function as:-
protected void Page_Load(object sender, EventArgs e)

{

if (fieldValue == "False")
{
 string xyz = "<script type='text/javascript' lang='Javascript'>myFunction();</script>";
 ClientScript.RegisterStartupScript(this.GetType(), "Window", xyz);
}
}

But on running this, these Javascript errors are coming:-

1. Object doesn't support this property or method.
2. 'undefined' is null or not an object



Please help how to achieve my objective. I am totally stuck.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Oct 2012, 04:50 AM
Hi Xorv,

Try the following code snippet in the Page_Load function.

C#:
protected void Page_Load(object sender, EventArgs e)
  {
    if (fieldValue == "False")
      {
         string script = "<script language='javascript'>function f(){openRadWindow(); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
         Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", script);
      }
  }

Hope this helps.

Regards,
Shinu.
0
Waseem
Top achievements
Rank 1
answered on 14 Oct 2012, 02:12 AM
My Dear use this for open Radwindow for specific condition in IF.

bool Check=true;
protected void Page_Load(object sender, EventArgs e)
{
 if(Check==true)
 {
 string script = "function f(){ var oWnd = $find(\"" + PrintWindow.ClientID + "\"); oWnd.setUrl('Testing.aspx'); oWnd.show();       Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
 }
}

Regards
Muhammad Waseem
Tags
Window
Asked by
Xorv
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Waseem
Top achievements
Rank 1
Share this question
or