datagrid sorting - Reflection.Assembly.Load - Nested WebControls

G

Garry

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
 
M

Mike Moore [MSFT]

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.


--------------------
 
G

Garry

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
 
J

Jacob Yang [MSFT]

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.
 
G

Garry

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
 
J

Jacob Yang [MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top