datagrid sorting - Reflection.Assembly.Load - Nested WebControls

Discussion in 'ASP .Net Datagrid Control' started by Garry, Sep 30, 2003.

  1. Garry

    Garry Guest

    Hi,
    I am using reflection to load strong name custom webcontrols from the
    GAC. Control names are fed from a database to dynamically render
    webcontrol to build a complete page. I have a composite control that
    contains a datagrid among other things. Loading and sorting works
    perfectly. I have also created another control that loads the first
    control. As soon as this occurs I loose sorting.

    I load and create and instance using these routines:
    System.Reflection.Assembly.LoadWithPartialName
    Activator.CreateInstance


    #1 Sorting Works:
    ASPX
    |- Load custom webcontrol "a" which contains a datagrid

    #2 Sorting Doesn't Work:
    ASPX
    |- Load custom webcontrol "b"
    |- which loads custom webcontrol "a" with the datagrid

    Basically the sorting event is not fired in scenario #2. I have no
    idea why.

    Anybody have any suggestions?

    Thanks,
    Garry McGillivary
    Garry, Sep 30, 2003
    #1
    1. Advertising

  2. Hi Gary,

    Sorry for the delay in responding. Due to a glitch, an earlier message did
    not get posted. I'm reposting it on behalf of my coworker, Jacob Yang.

    Based on my research and experience, the problem is when those two controls
    were loaded dynamically.

    Before the Page_Load event, asp.net loads in all the ViewState data, for
    example, recreating your controls on web page. Then it matches up the
    control that raises the postback with the actual control which was
    regenerated from the ViewState. At this point, ASP.NET knows that this
    particular control was fired and it adds the handler event to the list of
    events that must be executed.

    If the load phase was after the restore of the ViewState data, the event
    will not fired as expected.

    Thank you, Mike
    Microsoft, ASP.NET Support Professional

    Microsoft highly recommends to all of our customers that they visit the
    http://www.microsoft.com/protect site and perform the three straightforward
    steps listed to improve your computer’s security.

    This posting is provided "AS IS", with no warranties, and confers no rights.


    --------------------
    > From: (Garry)
    > Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > Subject: datagrid sorting - Reflection.Assembly.Load - Nested WebControls
    > Date: 29 Sep 2003 20:51:59 -0700
    > Organization: http://groups.google.com/
    > Lines: 29
    > Message-ID: <>
    > NNTP-Posting-Host: 66.161.246.234
    > Content-Type: text/plain; charset=ISO-8859-1
    > Content-Transfer-Encoding: 8bit
    > X-Trace: posting.google.com 1064893926 19903 127.0.0.1 (30 Sep 2003

    03:52:06 GMT)
    > X-Complaints-To:
    > NNTP-Posting-Date: 30 Sep 2003 03:52:06 GMT
    > Path:

    cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
    m!tdsnet-transit!newspeer.tds.net!sn-xit-02!sn-xit-06!sn-xit-05!sn-xit-09!su
    pernews.com!postnews1.google.com!not-for-mail
    > Xref: cpmsftngxa06.phx.gbl

    microsoft.public.dotnet.framework.aspnet.datagridcontrol:6830
    > X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    >
    > Hi,
    > I am using reflection to load strong name custom webcontrols from the
    > GAC. Control names are fed from a database to dynamically render
    > webcontrol to build a complete page. I have a composite control that
    > contains a datagrid among other things. Loading and sorting works
    > perfectly. I have also created another control that loads the first
    > control. As soon as this occurs I loose sorting.
    >
    > I load and create and instance using these routines:
    > System.Reflection.Assembly.LoadWithPartialName
    > Activator.CreateInstance
    >
    >
    > #1 Sorting Works:
    > ASPX
    > |- Load custom webcontrol "a" which contains a datagrid
    >
    > #2 Sorting Doesn't Work:
    > ASPX
    > |- Load custom webcontrol "b"
    > |- which loads custom webcontrol "a" with the datagrid
    >
    > Basically the sorting event is not fired in scenario #2. I have no
    > idea why.
    >
    > Anybody have any suggestions?
    >
    > Thanks,
    > Garry McGillivary
    >
    Mike Moore [MSFT], Oct 1, 2003
    #2
    1. Advertising

  3. Garry

    Garry Guest

    Mike,
    Thanks for the response.

    Interesting. That makes a lot of sense but I am still having trouble.

    Here's what I did. I overrode the LoadViewState sub in both controls
    and in the aspx and made calls to my rendering logic prior to calling
    the base LoadViewState. Of course I also included the same call in the
    page_load to kick things off and check isPostBack for subsequent
    calls. The net result is the same however. The page builds correctly
    but the sorting event never fires. Do you see anything wrong with this
    logic ?

    By the way, if you guys tried simulating this successfully I would
    love to see the code.

    Thx for your help,
    Garry
    Garry, Oct 3, 2003
    #3
  4. Hi Garry,

    Based on my research and experience, I would like to share the following
    information with you.

    It seems that the child control's event is not propagated to its parent
    control.hierarchy.

    The ASP.NET page framework provides a technique called event bubbling that
    allows a child control to propagate events up its containment hierarchy.
    Event bubbling enables events to be raised from a more convenient location
    in the controls hierarchy and allows event handlers to be attached to the
    original control as well as to the control that exposes the bubbled event.

    Event bubbling is used by the data-bound controls (Repeater, DataList, and
    DataGrid) to expose command events raised by child controls (within item
    templates) as top-level events.

    For more information, please check this article:

    Bubbling an Event
    http://msdn.microsoft.com/library/en-us/cpguide/html/cpconbubblingcommandeve
    nt.asp

    Does it answer your question? If I have misunderstood your concern, please
    feel free to let me know.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    Get Secure! ¨C www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jacob Yang [MSFT], Oct 5, 2003
    #4
  5. Garry

    Garry Guest

    Jacob,
    I think you misunderstood what I am trying to accomplish. Having the
    parent object recieve the sorting event doesnt help me. Also, my
    assumption is that for the event bubbling to work that I would need to
    recieve the "sorting" event to begin with. That never happens in the
    scenario I've outlined.

    All I really want is to recieve the event in the child control. It
    seems to me that it shouldn't matter what other control loads it. I
    must be missing something on the initialization. Something with
    viewstate maybe?

    Any other ideas?


    Thanks again,
    Garry McGillivary
    Garry, Oct 11, 2003
    #5
  6. Hi Garry,

    I have done a lot of research regarding this issue but I have not found a
    specific idea. I am truly sorry for it.

    Looking at the nature of this issue, I would highly recommend you contact
    Microsoft Product Support Services since it would require intensive
    troubleshooting which would be done quickly and effectively with direct
    assistance from a Microsoft Support Professional.

    Microsoft support home page: http://support.microsoft.com.
    To view support options:
    http://support.microsoft.com/default.aspx?scid=sz;en-us;top.
    To submit an online request:
    http://support.microsoft.com/default.aspx?scid=fh;en-us;incidentsubmit

    If you have any concerns regarding this issue, please feel free to let me
    know.

    Best regards,

    Jacob Yang
    Microsoft Online Partner Support
    Get Secure! ¨C www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.
    Jacob Yang [MSFT], Oct 13, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    2
    Views:
    836
    Matt Getting
    Jul 24, 2003
  2. Ian A. Mason

    Reflection & Nested Classes

    Ian A. Mason, Jun 30, 2004, in forum: Java
    Replies:
    2
    Views:
    765
    Tony Morris
    Jun 30, 2004
  3. Don
    Replies:
    0
    Views:
    363
  4. glitteringsounds
    Replies:
    1
    Views:
    1,327
    Alf P. Steinbach /Usenet
    Jul 3, 2010
  5. Patrick.O.Ige
    Replies:
    0
    Views:
    109
    Patrick.O.Ige
    Nov 29, 2004
Loading...

Share This Page