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

Display RadWindow after canceling form create event

1 Answer 18 Views
Window
This is a migrated thread and some comments may be shown as answers.
Liem
Top achievements
Rank 1
Liem asked on 20 Nov 2008, 05:20 PM
Hi,
I have a scheduler, when user click to Edit Or Insert, I need to check if he is authenticated, and display a Login page in RadWindow if he is not authenticated.

protected void RadScheduler1_FormCreating(object sender, Telerik.Web.UI.SchedulerFormCreatingEventArgs e)
    {
        if ((e.Mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) || (e.Mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert))
        {
            if ((bool)Session["isAuthenticated"] == false)
            {
                //Run Script
                string script = "<SCRIPT LANGUAGE='JavaScript'> ";
                script += "return DisplayLogin()";
                script += "</SCRIPT>";
                ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", script);

                
                e.Cancel = true;//Cancel the Edit or Insert form
            }
        }

    }


And here is javaScript to display RadWindow

<script language="javascript" type="text/javascript">
        function DisplayLogin()
        {            
            var oRadWindow = $find("<%=LoginRadWindow.ClientID%>");            
            oRadWindow.show();
            oRadWindow.restore();
            return false;
        }
</script>

My problem is the script does not run because I cancel the form Create event and there are no post back.
Is there any way to make it happens
Thanks

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 24 Nov 2008, 04:08 PM
Hi Liem,

I suggest to set the RadWindow's VisibleOnPageLoad property to true in teh server handler instead of executing a script from the server. Let me know whether this meets your requirements and scenario.


Sincerely yours,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Liem
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or