Dynamic grid in usercontrol

  1. #1

    Dynamic grid in usercontrol

    Hi All,

    in previous posts http://forums.ext.net/showthread.php...4393-16-1.aspx

    we talked about creating GridPanel at runtime. All fine at Page_Load of an aspx page.
    Reproducing code would be too long, so in my app. I have this structure:

    UserControl_A -> Button -> click AjaxEvent

    AjaxEvent does the following:

    - retrieve a DataTable
    - Load UserControl_B in wich at page_init I server side add store, grid etc.
    - pass DataTable to the grid

    After I click the button I get: ctl139_StoreRicerca is not defined

    Code in my error console (coolite-core-js/coolite.axd):

    var executeScript = function(o, result, response) {
                            var delay = 0;
                            var em = o.eventMask || {};
                            if (em.minDelay) {
                                delay = em.minDelay;
                            var task = new Ext.util.DelayedTask(
                                function(o, result, response) {
                                    if (result.script && result.script.length > 0) {
                                    if (o.userSuccess) {
                                        o.userSuccess(response, result, o.control, o.eventType, o.action, o.extraParams, o);
                                o.scope, [o, result, response]).delay(delay);
    // at eval(result.script); cursor breaks
    When I load UserControl I passed an ID to the UC object instance.

    Coolite.Ext.Web.Panel _pnlRisultatoRicerca = (Coolite.Ext.Web.Panel)this.Page.FindControl("PanelRisultatoRicerca");
    UserControlBase _ucRisultati = (UserControlBase)this.LoadControl("RisultatoRicerca.ascx");
    _ucRisultati.ID = "ucRes";
    Where am I wrong?

    Hope is clear



  2. #2

    RE: Dynamic grid in usercontrol

    Hi Matteo,

    I tried to recreate a sample based on your description but I'm not really getting the whole picture. I'll have to try again later or when you get a chance to post a code sample demonstrating how to reproduce.

    Geoffrey McGill
  3. #3

    RE: Dynamic grid in usercontrol

    Hi Geoff,

    yes ok. here it is the attached.

    Maybe this issue affects creating controls at runtime, that is not available at the moment.
    If there is one, I hope you can suggest an alternative. Quite urgent - as usual!

    I have TestWuc.aspx containing WucA. WucA has an ext:Button firing ajaxevent. In ajax event I load wuc WucB in which there is the dynamic creation of store, grid etc. I add the control to the ext:Panel in the .aspx page.

    From search button I have to create the grid according to the result of a query loaded on the fly.

    I could have chosed for an IFrame containing the grid, but then from the grid I have to execute some commands that are related to the original containing page that is not reachable from the IFrame page.

    Anyway, code should be more clear then my description.
    Let me know if there something wrong.


  4. #4

    RE: Dynamic grid in usercontrol

    Hi Geoff,

    did you see the file in attached?

    Can you help me with that?

    Thank you

  5. #5

    RE: Dynamic grid in usercontrol

    Hi Matteo,

    You create UserControl (which contains Coolite Controls) during AjaxEvent only. But creating Coolite controls during AjaxEvent is not supported yet. Therefore you have js error because the controls are absent on client page (just created store send back own data but store itself is absent on client)

    At this moment your sample can't work properly, only after adding support building dynamic controls during AjaxEvent

Similar Threads

  1. Dynamic UserControl + Direct Events
    By Zdenek in forum 2.x Help
    Replies: 4
    Last Post: Jul 22, 2012, 5:51 PM
  2. Replies: 0
    Last Post: Oct 26, 2011, 1:16 PM
  3. [CLOSED] Dynamic usercontrol and execute javascript
    By Patman in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 30, 2011, 4:50 PM
  4. dynamic load usercontrol in ext:pannel.
    By PrasadJoshi in forum 1.x Help
    Replies: 5
    Last Post: Jan 17, 2011, 9:54 AM
  5. [CLOSED] [1.0] Load dynamic UserControl with Coolite Controls.
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 22, 2010, 10:27 AM

Posting Permissions