View Full Version : How to create a window codebehind?

Mar 16, 2009, 5:12 PM
The question is simple, how to create a window via codebehind ?

I want to show this window on a button click, i have the button event working via AjaxEvents it work for disablind panels and other stuff, but i can´t show a window with something like:

Window w = new Window();
w.Title = "test";
w.Html = "test";

If the window is already created in the form, i can size it and show, but i need to use multiple windows.

Any help is welcome.
Thanks for now.

Mar 17, 2009, 7:42 PM
 Try adding the Window to the form.

        protected void Page_Load(object sender, EventArgs e)
            Window win = new Window("Fight in the Seas");



Mar 18, 2009, 9:05 AM
 thx for the try, isnt what i was looking for, alredy solved, look at example forum

Mar 23, 2009, 6:35 PM
Where specificly i can see this answer.thanks

Mar 23, 2009, 8:42 PM
If it helps anyone this is how I use Ajax to change client side behaviors of rendered windows and panels.  It also helps that I need to get the forms data back to my server field by field.  I am new to Coolite so I am sure there are better ways. If you have a better way of doing this, don't just flame me, Please post it!

1) The wire up: Notice the #{Window_Check_Context},  use just #{elementname} to return just the runtime control ID of the element.

<ext:Checkbox ID="chkDelete" runat="server" BoxLabel="delete"> 


<ext:Parameter Name="ctlid" Value="#{Window_Check_Context}" Mode="Raw" /> 

2) The Ajax Service - is a proxy for the elementid and also stores data into the session.  Besure that (EnableSession=true) if you want to persist the sessions accross Ajax requests.

[WebMethod(EnableSession = true)]
        public AjaxResponse RemoveEntry(string ctlid)
            if (Session.IsNewSession)
                return msgAlert("Access Denied!  Your session is likely expired!  Try logging in again.");


3) The Javascript Success function.  Your bouncing off the server (reporting any action or value that needs reporting to the server) and boucing back with the ControlID of the action you want to happen.  For me pageDispatch(result) takes a result set from the AjaxServices that defines what it wants the page to do.

function pageDispatch(result)
// response contains: this_action as the action; this_elem_id as the control to be acted upon; string[] params as //other optional params

var params = result.extraParamsResponse || {};

switch ( params. this_action )


case 'Window_Check_Context':


var elem = &#100;ocument.getElementById( params.this_elem_id);