Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataBinding
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00769841
Message ID:
00770112
Vues:
18
Bonnie,

I didn't see your reply until after I sent my message. Glad you came up with a working solution. Hopefully, MS will enhance ASP.NET to have two-way binding in the future.

>Hi Cathi,
>
>That's kinda what I wanted to do, but couldn't quite figure it out. The way I ended up solving it works ok too (see my reply to myself).
>
>~~Bonnie
>
>>Hi Bonnie,
>>
>>ASP.NET only offers one-way databinding, where WinForms offers two-way. To get the DataPostBack affect, you can raise an event in your sub-classed page class. Each control that handles databinding, when instantiated, can register with that event. That way when the event is fired, each control that is registered can take care of posting the data back to its datasource.
>>
>>
>>>Hey gang,
>>>
>>>I've got the idea of DataBinding in a Web page down, at least as far as setting the .Text property of a control equal to the bound table's column. I'm trying to figure out how to generically do the opposite of that, to save the user's changes in .Text back to it's bound column in the table.
>>>
>>>In the first case, I know that that if I say Page.DataBind(), it fires off a DataBinding event to each child control on the page, which I can then handle in each control's base class to set it's .Text property to the bound column. I'm doing this and it works splendidly.
>>>
>>>Now what I'm trying to do is the opposite. I want to have a Page.DataPostBack() method that I can call from the Form's Load(), that will in effect do the same thing ... fire off some kind of event (that I'm sure I'll have to create) for each of the child controls on the page. My question is how does the Page.DataBind() method do this? Is this overkill on my part (to create an event) or should my new Page.DataPostBack() method simply spin through each of the page's child controls and call a method on them? I guess what I'm asking is how is the Page.DataBind() method tied in with the Control.DataBinding event?
>>>
>>>I hope this question makes sense (I know, clear as mud probably ... <g>)
>>>
>>>~~Bonnie
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform