Aim:- I am trying to automatically open a radwindow from the server-side based on a specific IF condition.
Snippet Used:-
In the aspx page, I have defined the radwindow as follows:
<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 the JavaScript section, there is a function defined to open the radwindow:
function openRadWindow()
{
var oWnd = radopen('DisclaimerAlert.aspx', 'DisclaimerAlertWindow');
oWnd.set_title('Access Denied !');
oWnd.Center();
return false;
}
Therefore, in the Page Load event on the server side of the aspx page, I check an IF condition and then call the 'openRadWindow()' function like this:
protected void Page_Load(object sender, EventArgs e)
{
if (fieldValue == "False")
{
string xyz = "<script type='text/javascript' lang='Javascript'>openRadWindow();</script>";
ClientScript.RegisterStartupScript(this.GetType(), "Window", xyz);
}
}
Issue:-
However, when running this code, I encounter the following JavaScript errors:
- Object doesn't support this property or method.
- 'undefined' is null or not an object.
I would appreciate any assistance on how to achieve my goal as I am currently stuck.