[CLOSED] Open window from checkbox

  1. #1

    [CLOSED] Open window from checkbox

    Hi Guys
    Just learning ext and javascript ... i need to display an ext:window when a checkbox is "checked" (and only when it is checked, not unchecked) ... easy to do on a postback but I'd like to do it on the client.

    Any assistance much appreciated.
    (btw, really appreciating the Coolite tools).
  2. #2

    RE: [CLOSED] Open window from checkbox

    Hi Adrian,

    You can attach a <Check> Listener to the <ext:Checkbox> to control the show/hide of a <ext:Window>.

    The following code sample demonstrates.

    Example

    <ext:Checkbox ID="Checkbox1" runat="server">
        <Listeners>
            <Check Handler="(this.checked) ? Window1.show() : Window1.hide();" />
        </Listeners>
    </ext:Checkbox>
    
    <ext:Window 
        ID="Window1" 
        runat="server" 
        Closable="false"
        Title="Title"
        Show&#111;nload="false"
        />
    After the v0.6 release, I would suggest changing the <Check> line to the following sample.

    Example

    <Check Handler="(this.checked) ? #{Window1}.show() : #{Window1}.hide();" />
    Wrapping the "Window1" ID with a #{} token will instruct the Toolkit to replace the #{} token with the actual .ClientID of the Control. The controls are instantiated client-side with their .ClientID's, which may be different than their server-side .ID.

    Out of interest sake, I also tried the same scenario using the new <AjaxEvents> feature of v0.6. The following sample demonstrates adding a <Check> AjaxEvent to the <ext:Checkbox> which makes an ajax request/response back to the server and fires a custom "Checkbox1_Check" event.

    Example

    <script runat="server">
        protected void Checkbox1_Check(object sender, AjaxEventArgs e)
        {
            if (this.Checkbox1.Checked)
            {
                this.Window1.Show();
            }
            else
            {
                this.Window1.Hide();
            }
        }
    </script>
    
    <ext:Checkbox ID="Checkbox1" runat="server">
        <AjaxEvents>
            <Check OnEvent="Checkbox1_Check" />
        </AjaxEvents>
    </ext:Checkbox>
    Hope this helps.

    p.s. Thanks for the feedback! much appreciated.

    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Open window from checkbox

    Thanks Geoffrey ... works like a charm ... the support you're providing through this forum is brilliant.

    Really looking forward to <AjaxEvents> ... its going to make working with Ext for asp.net developers - like myself - so much easier (and more powerful).

Similar Threads

  1. [CLOSED] Re-open window with TriggerField
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 25, 2013, 1:04 PM
  2. [CLOSED] open window out of its parent
    By imaa in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 26, 2011, 6:07 AM
  3. BorderLayout open a window black window
    By Hualin Yuan in forum 1.x Help
    Replies: 0
    Last Post: May 07, 2010, 3:03 AM
  4. [CLOSED] open window by javascript
    By pank in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 16, 2009, 3:36 AM
  5. [CLOSED] Open window from javascript
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 16, 2009, 3:28 AM

Posting Permissions