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

How Open RadWindow Popup on Button Click Handler

8 Answers 1484 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ravi Kumar
Top achievements
Rank 1
Ravi Kumar asked on 27 Jul 2010, 07:08 AM
Hi,

I have user control, in which  have "Add" button. now i,m calling this user control in my page and firing click event of Add button (which is in the user control)

       protected void Page_Init(object sender, EventArgs e)
        {
            HeaderToolBar1.Add_Event += new WFSite.ViewControls.HeaderToolBar.AddDelegate(HeaderToolBar1_Add_Event);
          }

        void HeaderToolBar1_Add_Event(object sender, RadToolBarEventArgs e)
        {
           // How to open radwindow popup
        }


Thank you
Ravi

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jul 2010, 07:34 AM

Hello Aravind,

You can open the RadWindow from the server by setting its VisibleOnPageLoad property to true.

C#:

RadWindowManager windowManager = new RadWindowManager();  
RadWindow widnow1 = new RadWindow();  
// Set the window properties  
widnow1.NavigateUrl = "Window1.aspx";  
widnow1.ID = "RadWindow1";  
widnow1.VisibleOnPageLoad = true; // Set this property to True for showing window from code  
windowManager.Windows.Add(widnow1);  
this.form1.Controls.Add(widnow1);

More information on the subject is available here:

http://www.telerik.com/help/aspnet-ajax/window_settingserversideproperties.html

-Shinu.

0
Ravi Kumar
Top achievements
Rank 1
answered on 27 Jul 2010, 08:38 AM
Hi Shinu

Thanks for reply.

User Control (HTML):
<telerik:RadToolBar ID="RadToolBar1" runat="server" Height="26px" Width="100%" OnButtonClick="RadToolBar1_ButtonClick">
    <Items>
        <telerik:RadToolBarButton runat="server" ImageUrl="~/Images/TLB_ADDNEW_16.gif" Text="<%$ Resources:PDICulture, htbControlAdd %>"
            ToolTip="<%$ Resources:PDICulture, htbControlToolTipAdd %>">
        </telerik:RadToolBarButton>
    </Items>
</telerik:RadToolBar>

User Control Code Behind:

 public delegate void AddDelegate(object sender, RadToolBarEventArgs e);
 public event AddDelegate Add_Event;

  protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
   {
       Add_Event(sender, e);
     }


Content Page in which i,m using user control

void HeaderToolBar1_Add_Event(object sender, RadToolBarEventArgs e)
        {
           // How to open radwindow popup
           RadWindowManager windowManager = new RadWindowManager();
            RadWindow widnow1 = new RadWindow();
            // Set the window properties   
            widnow1.NavigateUrl = "DateDialog.aspx";
            widnow1.ID = "RadWindow1";
            widnow1.VisibleOnPageLoad = false; // Set this property to True for showing window from code   
            windowManager.Windows.Add(widnow1);
            this.Controls.Add(widnow1);
        }

Its not working at my end. Can you see whats going wrong.

Thank you
Ravi

 
0
Georgi Tunev
Telerik team
answered on 27 Jul 2010, 01:17 PM
Hello Ravi,

In your code you:
1. Create a RadWindowManager
2. Create a RadWindow
3. Set RadWindow's properties
4. Add RadWindow to RadWindowManager's collection.

You don't add the manager to the page however. I would also recommend to add the controls not directly to the page, but to the form or better - to a placeholder inside that form.


Sincerely yours,
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
0
Ravi Kumar
Top achievements
Rank 1
answered on 28 Jul 2010, 09:11 AM

Thanks for reply

its working fine now. you are rock!!!

Thank you
Ravi
0
Robert Smith
Top achievements
Rank 1
answered on 29 Jul 2010, 03:11 PM
Ravi,

I'm having same problem but i have not figured out the fix.  Can you please post your final code that fixed for you?

0
Ravi Kumar
Top achievements
Rank 1
answered on 02 Aug 2010, 08:17 AM
Hi,
You can use


 protected void btnMESetPassword_OnClick(object sender, EventArgs e)
        {
            RadAjaxManager1.ResponseScripts.Add("openRadWindow()");
        }

 function openRadWindow()
        {
             var firstName = $("#<%= txtMEFirst.ClientID %>").val();
             var middleName = $("#<%= txtMEMiddleInitial.ClientID %>").val();
             var lastName = $("#<%= txtMELast.ClientID %>").val();
             var employeeid = $("#<%= txtMEEmployeeProfileID.ClientID %>").val();
             var name = employeeid + ' - ' + firstName +' ' + middleName + ' ' + lastName;
             var oWnd = radopen("SetPasswordDialog.aspx?EmployeeName=" + name, "PasswordWindow");
       
        }
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
<telerik:RadWindow Modal="true" Width="400px" Height="200px" Behaviors="Move, Close"
                ReloadOnShow="true" ID="PasswordWindow" runat="server" VisibleStatusbar="true"
                NavigateUrl="SetPasswordDialog.aspx" OnClientClose="OnClientCloseSetPassword" />
        </Windows>
</telerik:RadWindowManager>

-Ravi
0
Rohan
Top achievements
Rank 1
answered on 28 Nov 2012, 07:44 AM
Hi all,

I want to open the radwindow on delegate event ,i try this code

  RadWindow window1 = new RadWindow();
            window1.NavigateUrl = "http://www.google.com";
            window1.VisibleOnPageLoad = true;
            window1.Width = 500;
            window1.Height = 300;
            this.Controls.Add(window1);

but it doesn't work ...please provide any snap or document
0
Danail Vasilev
Telerik team
answered on 30 Nov 2012, 04:28 PM
Hi Rohan,

А possible scenario in your case could be that you are ajaxifying some part of the page and the form is not updated. You have to add the window object to the form not just to the page. Please refer to this article which will shed more light on how to open RadWindow from the server.

All the best,
Danail Vasilev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Ravi Kumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ravi Kumar
Top achievements
Rank 1
Georgi Tunev
Telerik team
Robert Smith
Top achievements
Rank 1
Rohan
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or