HOW TO USE RADWINDOW LIKE POPUP WINDOW IN ASP.NET

In this article, We have explained regarding RadWindow in ASP.NET. RadWindow is a telerik control. Here I explained how to use RadWindow like popup window in ASP.NET. These are the following Codes...

Write a Script in Design Page:

<script type="text/javascript">
        function Open(win) {
            var window = document.getElementById(win);
            window.control.Show();
        }
        function Close(win) {
            var window = document.getElementById(win);
            window.control.Close();
        }
    </script>

Drag and Drop one RadWindow and one Button in Design Page:

<telerik:RadWindow runat="server" ID="RadWindow1" Modal="false" Width="670px" Height="350px" Title="Add Skill" Animation="None" AutoSize="false" Behaviors="Default">
        <ContentTemplate>
           <div>
             <h1>PopUp Window</h1>
          </div>
        </ContentTemplate>
    </telerik:RadWindow>
<telerik:RadButton ID="btnOpen" runat="server" Text="Open PopUp" OnClick="btnOpen_Click"></telerik:RadButton>

Write These Below Coding in Back-End / .cs page:

protected void btnOpen_Click(object sender, EventArgs e)
        {
            OpenPopUp();
        }
private void OpenPopUp()
        {
            string script = "function f(){Open('" + RadWindow1.ClientID + "'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
private void ClosePopUp()         {             string script = "function f(){Close('" + RadWindow1.ClientID + "'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);         }

Post a Comment

0 Comments