1. #1
    Ext User mclerte's Avatar
    Join Date
    Oct 2007
    Posts
    20
    Vote Rating
    0
    mclerte is on a distinguished road

      0  

    Default No form submit with ASP.NET and Ext.Window

    No form submit with ASP.NET and Ext.Window


    Hi ,

    I have been trying for 3 days to get a correct asp.net postback event for some asp.net controls put inside an Ext.Window... no success...

    First it appears that an ASP:Button cannot submit the form when put within the Ext.Window, apart if we specify UseSubmitBehavior to false (which renders an INPUT Type=Button instead of a type=submit and makes a call to __dopostback() javascript function to post the form).

    If we put a LinkButton in the window it does do the callback (of course 'cos its calling __doPostBack() too)

    So first question : why does the UseSubmitBehavior is compulsory for ASP:Button within Ext Window ?

    Second, I decided to add a ASP:TextBox within the window, and code a simple Button1_OnClick server side event handler where I just read the value of the textbox... and it is always empty !!!
    so, second question : why can't we get the posted values of .net webcontrols ?

    Thanks heaps
    Mat

  2. #2
    Ext User mclerte's Avatar
    Join Date
    Oct 2007
    Posts
    20
    Vote Rating
    0
    mclerte is on a distinguished road

      0  

    Default


    By tracing my postback i've found that none of the asp.net webcontrols declared within the Div of my Ext.Window is posted back.. (= not contained Request.Form collection )

    So i guessed that it was probably because the ExtJs javascript code removes them from the forms' children, and i decided to attach an OnSubmit event to the form pointing to the following javascript function :

    Code:
    function attachWindowContentsToForm() {
        var form1 = document.getElementById('form1'); // traditionally asp.net runat server form is named 'form1'
        var win = document.getElementById('win'); // the ID of the DIV used as el for my Ext.Window
    
        form1.appendChild(win);
    }
    and basically as the window is recreated after the postback, everything is displayed properly.


    Still i'd like someone to explain me why i have to do this ....
    }

  3. #3
    Ext User
    Join Date
    Aug 2007
    Posts
    23
    Vote Rating
    0
    photoz is on a distinguished road

      0  

    Default


    I'm also in the same boat, the controls that get put in a window are moved out of the form tag, so you don't get access to them on postback.

    Would be great if you could setup a window config to give it a container object.

  4. #4
    Ext User
    Join Date
    Aug 2007
    Posts
    23
    Vote Rating
    0
    photoz is on a distinguished road

      0  

    Default


    well, against my better judgment, I went in and modified the ext code. yikes!

    around line 77 col 3900 is the Ext.Window.show function, here is the modification:

    Code:
    show:function(C,A,B){if(!this.rendered){this.render(Ext.get('form1'))}
    instead of

    Code:
    show:function(C,A,B){if(!this.rendered){this.render(Ext.getBody())}
    I'm obviously unsure of the ramifications this could pose down the line, but it solved my problems and should solve the OP's as well.

  5. #5
    Ext User
    Join Date
    Jun 2007
    Posts
    7
    Vote Rating
    0
    aux88 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mclerte View Post
    Code:
    function attachWindowContentsToForm() {
        var form1 = document.getElementById('form1'); // traditionally asp.net runat server form is named 'form1'
        var win = document.getElementById('win'); // the ID of the DIV used as el for my Ext.Window
    
        form1.appendChild(win);
    }
    Thank you for the workaround! I would definitely waste more time that just 3 days trying to figure out what's going on.

  6. #6
    Ext User
    Join Date
    Jul 2007
    Posts
    32
    Vote Rating
    0
    migo_config is on a distinguished road

      0  

    Default


    isnt this then assuming that every page you use an ext window will have a "form1"?

  7. #7
    Ext User
    Join Date
    Aug 2007
    Posts
    23
    Vote Rating
    0
    photoz is on a distinguished road

      0  

    Default


    yes, that is the assumption when using asp.net

  8. #8
    Ext User
    Join Date
    Jul 2007
    Posts
    32
    Vote Rating
    0
    migo_config is on a distinguished road

      0  

    Default


    well much as i don't really like it I did it anyway and you're right it works. Thanks! A month from now an error is going to pop up somewhere and ill wonder what on earth happened guaranteed.

  9. #9
    Ext User
    Join Date
    Aug 2007
    Posts
    23
    Vote Rating
    0
    photoz is on a distinguished road

      0  

    Default


    yes, its not a graceful hack and when you upgrade versions you have to remember to make the change again.

    the Ext peeps don't prefer to code for anything platform specific, which makes sense to keep it a universal js framework.

  10. #10
    Ext User
    Join Date
    Dec 2007
    Location
    Indianapolis
    Posts
    52
    Vote Rating
    0
    Emmster is on a distinguished road

      0  

    Default


    Thank you for that. I'd be racking my brain these past couple of days trying to figure out why my button wasn't firing!

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar