Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Additional Controls???
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00848132
Message ID:
00851168
Vues:
17
>
>mmWebDataHelper.ControlBindData(this,(Control) control,bindingSource,bindingMember,null);
>
>
>which I changed to:
>
>
>mmWebDataHelper.ControlBindData(Page,(Control) control,bindingSource,bindingMember,null);
>
>
>All the references to "this" now refer to the user control and not the "Page" so I had to change "this" to "Page".


That should be fine. The binding is against the container which in most cases is the page, but as in your case can be a another user control...

>The two way binding is now working, but there's some kind of problem with the validation. I'm getting this error:
>
>The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... ).

This is something different. This has to do with some expressions in your ASPX markup page where there's angle brackets inside of a string somewhere. Find any double quotes that have embedded script tags and try to change those to single quotes - that works most of the time, but sometimes you can't get things to work without double quotes (event script calls etc.).


>I was also curious if there's some kind of "pattern" that describes how to move functionality from a container class to a contained container class. Perhaps there's some methodology to keep the page container with all it's methods and have the contained container (in this case the user control) pass specific calls up to it's parent

Well the problem here is that the control must register with the page in order to get notified of databinding events. So really it probably makes sense to always use Page instead of this (the current container)... I have to think about that...

The object databinding in MM is different than the databinding I use in my control framework stuff as to be consistent with the databinding event model that the true databinding uses. The disadvantage with the MM method is that it relies on these events to be registered with the page. In my method I just loop through and all subcontrols and find the controls to bind or unbind so that is a little more flexible because there's no direct dependency between page and control (and I have fewer parameters to pass). Offhand I can't think of a solution to make this work in MM - I have to look at that code again to see how the callbacks work.

For the moment you're on the right track though...

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform