[CLOSED] Problem trying to load a combo-user-control inside a window-user-control.

  1. #1

    [CLOSED] Problem trying to load a combo-user-control inside a window-user-control.

    Problem trying to load a combo-user-control inside a window-user-control.
    ------

    Hi there.

    I use this example in order to achieve to load-and-render a window-user-control only when I need it. And works fine.
    But, now I am having problems with one window-user-control than has another user control (a combo-user-control) inside it.
    When I try to show the window-user-control, the system crashes because doesnt find the store used by the combo-user-control.
    I think than I am doing all fine because I proved another approach: extract all the code of the combo-user-control and inserted it inside the window-user-control (result: a window-user-control without any user-controls inside it) and that works fine.
    Do I have to do a special treatment of the user controls (and its stores) when I try to put them inside a window-user-control?
    My reason to use user controls is: in that way I can encapsulate controls (and their functionality) and use them in several parts of my app without carring and duplicate a lot of code in all the app.
    Please giveme a hint to achieve this or please let me know if this approach than I try to do (user-controls inside user-controls) is no-recommended when using Ext.Net controls.

    Thanks in advance.
    Last edited by Daniil; Feb 10, 2012 at 4:15 PM. Reason: [CLOSED]
  2. #2
    By the way, I see in other posts in this forum (and in several examples in the ext net demo-page) than we can use dynamic ext net controls created in codebehind and then add them using a ContentPlaceHolder.
    A very-very personal thought: that approach is harder to read and to mantain than html-normal-code.
    Because of that, I prefer to create user controls and render it when I need it.
    But now comes a question: using user-controls and render them when I need is equivalent to use dynamic code? Is there a big difference in performance or something?
    I am doing this question here because I think is pretty related to this thread, but if I need another thread for it, please let me know.
  3. #3
    Hi,

    the system crashes because doesnt find the store used by the combo-user-control
    How do you add the Store for the ComboBox? Placing into the ComboBox's Store collection or setting up its StoreID property?

    I guess you set up StoreID. Please note that before rendering the control with StoreID, that Store must be placed into some of Page's controls collection, for example, into:
    this.Form.Controls
    In a different way, the system will be unable to find that Store.

    Or place the Store into the ComboBox's Store collection instead of setting up its StoreID property.

    Do I have to do a special treatment of the user controls (and its stores) when I try to put them inside a window-user-control?
    Well, no special requirements. Though, please don't forget about ASP.NET doesn't recreate any controls automatically. Since if you would like to use DirectEvent of dynamically rendered controls, you will need to recreate them manually.

    Some more details are here:
    http://forums.ext.net/showthread.php...ll=1#post60155

    Please note that the Store's OnRefreshData event is also DirectEvent.
    But now comes a question: using user-controls and render them when I need is equivalent to use dynamic code? Is there a big difference in performance or something?
    There is no big difference in performance.

    But note if you will need to "destroy" a user control, for example, replacing it with another one, you will need to destroy Ext.NET widgets manually, like this:
    http://examples1.ext.net/#/XRender/U...UpdateContent/
    Last edited by Daniil; Feb 06, 2012 at 10:23 AM.

Similar Threads

  1. Replies: 7
    Last Post: Jan 29, 2013, 12:59 PM
  2. [CLOSED] Problem on dynamic load user control
    By andreasperanza in forum 1.x Premium Help
    Replies: 13
    Last Post: Dec 22, 2011, 5:23 PM
  3. Replies: 8
    Last Post: Jan 25, 2011, 5:21 AM
  4. Replies: 3
    Last Post: May 11, 2010, 11:36 AM
  5. Replies: 1
    Last Post: Mar 09, 2010, 3:55 AM

Posting Permissions