Using r.a.d.window for a login form

Thread is closed for posting
7 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 12 Jan 2007 Link to this post

    Requirements

    r.a.d.window version

    1.x

    .NET version

    2.x

    Visual Studio version

    2005

    programming language

    C#, VB.NET, Javascript

    browser support

    all browsers supported by r.a.d.window


     
    PROJECT DESCRIPTION
    This code library project is based on the Postback from RadPrompt forum thread.
    In the project, r.a.d.window is used to open a login form which will redirect the parent page to a specific URL after a successful login.
    To achieve this, you will need to update an asp:label on the login form using some JavaScript that will redirect the parent page and will close the RadWindow.

    CodeBehind:

    protected void Button1_Click(object sender, EventArgs e)  
    {  
        if(TextBox1.Text=="admin" && TextBox2.Text=="admin")  
            {  
            Response.Write("Login successful");  
            Label1.Text="<script type='text/javascript'>top.location.href='http://google.com';GetRadWindow().Close();</script>";  
            }  
            else 
            {  
                Response.Write("Invalid login credentials");  
            };  


  2. BFFFA6C8-6FEA-40C2-8D21-853D155EFA2E
    BFFFA6C8-6FEA-40C2-8D21-853D155EFA2E avatar
    3 posts
    Member since:
    Aug 2009

    Posted 15 Sep 2009 Link to this post

    thank you very very much
  3. C4E44FC7-1CB3-4296-97D7-C9BAD7A77F67
    C4E44FC7-1CB3-4296-97D7-C9BAD7A77F67 avatar
    1 posts
    Member since:
    Jun 2005

    Posted 10 Feb 2010 Link to this post

    I can't get my modal window to close no matter what I try.  The diff with mine is it's ajaxified.  Tried variations of scriptmanager.registerstartupscript etc, tried the suggestion in this thread, can't seem to get anywhere.  If I use

    ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "CloseWindow", "alert('hello');", True) 

    I get an alert so I know the script is being written to the client but anything to try to close the window fails / seems to do nothing.

    Here's what my page looks like:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %> 

     

    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 

        Namespace="System.Web.UI" TagPrefix="asp" %> 

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

    <html xmlns="http://www.w3.org/1999/xhtml">  

    <head runat="server">  

        <title>Change</title> 

        <link rel="stylesheet" type="text/css" href="/x/Styles.css" /> 

    </head> 

    <body> 

        <form id="form1" runat="server">  

     

            <script type="text/javascript">  

        function GetRadWindow()  

            {  

                var oWindow = null;  

                if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  

                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)  

                return oWindow;  

            }  

          

            </script> 

     

            <div> 

                <asp:ScriptManager ID="ScriptManager1" runat="server">  

                </asp:ScriptManager> 

                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> 

                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">  

                    <asp:Literal ID="Literal1" runat="server"></asp:Literal> 

                    <table class="window">  

                        <tr> 

                            <td> 

                                Enter an Organization Code<br /> 

                                <asp:TextBox ID="txtID" runat="server">  

                                </asp:TextBox> 

                                <br /> 

                                <br /> 

                                <hr noshade="noshade" size="1px" /> 

                                OR  

                                <hr noshade="noshade" size="1px" /> 

                                <br /> 

                                <!--Choose a State<br />--> 

                                <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="200px" OnClientSelectedIndexChanging="LoadCities" 

                                    OnItemsRequested="RadComboBox1_ItemsRequested" /> 

                                <br /> 

                                <br /> 

                                <!--Choose a City<br />--> 

                                <telerik:RadComboBox ID="RadComboBox2" runat="server" Width="200px" OnClientSelectedIndexChanging="LoadAffs" 

                                    OnClientItemsRequested="ItemsLoaded" OnItemsRequested="RadComboBox2_ItemsRequested" /> 

                                <br /> 

                                <br /> 

                                <!--Choose an Affiliate Organization<br />--> 

                                <telerik:RadComboBox ID="RadComboBox3" runat="server" Width="200px" OnClientItemsRequested="ItemsLoaded" 

                                    OnItemsRequested="RadComboBox3_ItemsRequested" /> 

                                <br /> 

                                <br /> 

                                <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> 

                                <br /> 

                                <br /> 

                                Can't find the group you're looking for? <href="/x.aspx">  

                                    Click here</a> to learn how you can refer a group for Affiliate support.  

                            </td> 

                        </tr> 

                    </table> 

                </telerik:RadAjaxPanel> 

                <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">  

     

                    <script type="text/javascript">  

    //global variables for the countries and cities comboboxes  

    var cityCombo;  

    var citiesCombo;  

     

    function pageLoad()  

    {  

        // initialize the global variables  

        // in this event all client objects   

        // are already created and initialized   

        cityCombo = $find("<%= RadComboBox2.ClientID %>");      

        affCombo = $find("<%= RadComboBox3.ClientID %>");  

    }  

     

    function LoadCities(combo, eventArqs)  

    {      

        var item = eventArqs.get_item();  

        cityCombo.set_text("Loading...");  

        affCombo.clearSelection();  

          

        // if a continent is selected  

        if (item.get_index() > 0)  

        {          

            cityCombo.requestItems(item.get_value(), false);   

        }  

        else  

        {  

            cityCombo.set_text(" ");  

            cityCombo.clearItems();  

              

            affCombo.set_text(" ");  

            affCombo.clearItems();  

        }  

    }  

     

    function LoadAffs(combo, eventArqs)  

    {      

        var item = eventArqs.get_item();  

          

        affCombo.set_text("Loading...");  

        affCombo.requestItems(item.get_value(), false);                      

    }  

     

    function ItemsLoaded(combo, eventArqs)  

    {      

        if (combo.get_items().get_count() > 0)  

        {  

         // pre-select the first item  

            combo.set_text(combo.get_items().getItem(0).get_text());  

            combo.get_items().getItem(0).highlight();  

        }  

        combo.showDropDown();  

    }  

                    </script> 

     

                </telerik:RadScriptBlock> 

            </div> 

        </form> 

    </body> 

    </html> 

     

  4. 000585EE-7DFC-4C10-B6EB-448F2DA3AFB4
    000585EE-7DFC-4C10-B6EB-448F2DA3AFB4 avatar
    7207 posts
    Member since:
    Jul 2016

    Posted 16 Feb 2010 Link to this post

    Hi Sam,

    Your code is in an Ajax panel - that is why you should use RadAjaxPanel's ResponseScripts collection:

    protected void btnSubmit_Click(object sender, EventArgs e)
        {
            RadAjaxPanel1.ResponseScripts.Add("GetRadWindow().close();");
        }



    Regards,
    Georgi Tunev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. 5A3DFC44-BE99-4951-BAB1-B3EC2B3DF643
    5A3DFC44-BE99-4951-BAB1-B3EC2B3DF643 avatar
    111 posts
    Member since:
    Oct 2007

    Posted 05 Jun 2010 Link to this post

    I have the login control on its own page.. which i call through the radwindow.. upon logging in, i redirect the page
    to this one.. where a little jquery goes a long way.



     <script type="text/javascript">  
           
             function CloseWindow() {  
                 GetRadWindow().Close();  
             }  
             function GetRadWindow() {  
                 var oWindow = null;  
                 if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
                 else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)  
     
                 return oWindow;  
             }  
     
            </script> 


    <
    body> 
        <form id="form1" runat="server">  
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
         <Scripts>         
           <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />   
           <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />      
          </Scripts>   
        </telerik:RadScriptManager> 
          
        <script type="text/javascript">  
            window.jQuery = window.$ = $telerik.$;  
            $(document).ready(function() {  
                CloseWindow();  
            });  
                      
              </script> 
          
      <div style="text-align:right; z-index: 999;">  
        <asp:HyperLink ID="hypClose" runat="server" Text="Close" NavigateUrl="javascript:void(0);"></asp:HyperLink> 
        </div> 
        <div> 
          
        </div> 
        </form> 
    </body> 
  6. 93662917-1E03-49EC-9286-033C9D1BF79E
    93662917-1E03-49EC-9286-033C9D1BF79E avatar
    1406 posts
    Member since:
    May 2014

    Posted 10 Jun 2010 Link to this post

    Hello Sircutbreaker,

    I am not quite sure that I understood the problem that you experience. Could you please provide me with more details about the behavior that you experience and the expected result, that you need to achieve? Also, could you please provide me with information about the version that you use. I see that you use RadControl for ASP.NE TAJAX (the provided KB is for RadControl for ASP.NET), but I need the exact version of the Telerik.Web.UI.dll. You can check the version by just hovering the mouse over the Telerik assembly.

    Kind regards,
    Fiko
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. 5A3DFC44-BE99-4951-BAB1-B3EC2B3DF643
    5A3DFC44-BE99-4951-BAB1-B3EC2B3DF643 avatar
    111 posts
    Member since:
    Oct 2007

    Posted 10 Jun 2010 Link to this post

    Not experiencing a problem. I was posting a solution.

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.