[CLOSED] XRender UserControl NamingContainer

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] XRender UserControl NamingContainer

    Hi,
    In the XRender Example for UserControl, everything works fine. However, I want to set a custom Naming Container for the User Control that is being loaded. How can I do that?
    The following is what I tried but give me error:

    Control xyz=new Control();
    xyz = this.LoadControl("xyz.ascx");
    xyz.ID="cal";
    xyz.NamingContainer.ID="cal1"; (Get Error on this line as "Object Reference not set to an instance of an Object")
    
    Page.Controls.Add(xyz);
    If I remove the Naming Container line, the control ID's are prefixed with ctl1_

    I hope you got my point...

  2. #2

    RE: [CLOSED] XRender UserControl NamingContainer

    Hi,

    I am not sure that issue is related with XRender.


    I believe that NamingContainer should be accessable after puting control to the Controls collection.
    I think you have to change Page ID (page is container for your user control) to change that user control prefix
  3. #3

    RE: [CLOSED] XRender UserControl NamingContainer

    No I dint mean that its related to XRender. The subject line was just as reference to that example.

    Even if I set the naming container id after adding to controls collection, I get the same error.


    When we add a control inline in mark up, whatever the ID of the control we provide is set as the prefix.


    In this case it is not...


    I tried to find a lot, but could'nt find it. I would really appreciate if you can help me with this.


    For eg: You can update the XRender User Control sample to prefix custom ID, instead of dynamically generated id.


    Lemme know if you dont get what I mean...


    Thanks,

  4. #4

    RE: [CLOSED] XRender UserControl NamingContainer

    Hi,

    If you test that XRender example then you'll see that NamingContainer is not null after the following line
    this.Panel1.ContentControls.Add(uc1);

    Do you add the user control inside Page.Controls or inside another container? Does that container is added to another control (container should have reference on Page)?
  5. #5

    RE: [CLOSED] XRender UserControl NamingContainer

    I am adding it to the Page controls and not to any other container...


  6. #6

    RE: [CLOSED] XRender UserControl NamingContainer

    Hi,

    Can you provide test example? Or modified that XRender example to demonstrate the issue?
  7. #7

    RE: [CLOSED] XRender UserControl NamingContainer

    Will do by evening...

    Did you look at my other query in the forum for Javascript Intellisense...
  8. #8

    RE: [CLOSED] XRender UserControl NamingContainer

    Hi,

    Yes, I saw. Unfortunatelly it is know problem which is not resolved yet
    http://forums.ext.net/showthread.php...14349-5-1.aspx
  9. #9

    RE: [CLOSED] XRender UserControl NamingContainer

    Ok...I hope I am using the correct Ref URL...




    As for this post... I think if I add the control to the Container with an ID, I should be able to resolve it... But just wondering... How does the Mark up adding of user control work... How does it create a naming container?
  10. #10

    RE: [CLOSED] XRender UserControl NamingContainer

    Hi,

    How does the Mark up adding of user control work... How does it create a naming container?
    To answer on those questions is required to investigate ASP.NET source code


    But I think that control see own parent controls hierarchy and if find any control which implemented INamingContainer then return that control in the own NamingContainer property. But I could be wrong
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 1
    Last Post: May 29, 2013, 6:00 PM
  2. XRender call DirectMethods from UserControl
    By vucuongkg in forum 2.x Help
    Replies: 1
    Last Post: Mar 19, 2012, 10:58 AM
  3. Replies: 8
    Last Post: Feb 15, 2012, 9:04 AM
  4. Replies: 0
    Last Post: Aug 03, 2011, 10:27 PM
  5. [CLOSED] XRender UserControl DirectMethod
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 22, 2010, 1:03 PM

Posting Permissions