Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Coordinating Objects
Message
De
26/08/2007 15:40:06
 
 
À
26/08/2007 14:47:45
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Divers
Thread ID:
01250452
Message ID:
01250512
Vues:
14
This message has been marked as a message which has helped to the initial question of the thread.
Well, no, you can't databind 2 controls together in the classic sense of the meaning of databind. It sounds like your custom control is going to need to have an EventHandler for the DateSelected event of the Calendar. Then in your EventHandler, use the selected date to plug it into your TextBox ... if the TextBox is part of your custom control. However, if I understand you correctly, that's not how you're doing it. The difference between how my custom control looks and functions is different from yours. I suggest combining your TextBox as part of your custom control.

~~Bonnie



>Hi Bonnie,
>
>You got the basic idea. I have a custom control I just created that is a time picker, I use the standard calendar control for a date picker. Together they make up a date time picker control. Which sits on a drop down form activated from the textbox.
>
>The textbox will definitely be databound to the dataset.
>
>Is it possible to bind a control to something other than a dataset? For instance could 2 controls be bound together?
>
>Thanks
>
>John
>
>>John,
>>
>>I'm not sure I understand your control model. Our DateTimeControl consists of a UserControl, on which two TextBoxes (one for Date one for Time) and a button are placed. Clicking the button pops up a Calendar control.
>>
>>Our DateTimeControl is databound like any other control (passing the table and column to be bound), and then the DateTimeControl's DataBind method binds the appropriate pieces to the two text boxes. Regular Expressions and Event Handlers are used to make it all work together. Our DateTimeControl is a very complicated control (and off the top of my head, I don't remember all the events that are used) ... it took one of our brightest developers close to 6 weeks to get it all working right, (although that was back in 2002 when we were all still learning C# ... it probably would take him less time now if he had to do it all over again, which thankfully isn't necessary <g>).
>>
>>Because it's so complex, I can't post the code for it (and I doubt if our company would let me anyway), but maybe my above explanation of how it works might help?
>>
>>~~Bonnie
>>
>>
>>>I am working on a time picker control and am trying to decide on the best way to coordinate the value of the control between the various objects invlolved.
>>>
>>>
>>>Dataset
>>>  TextBox
>>>    DropDownForm (Form)
>>>      TimePicker (UserControl)
>>>        LabelArray (Acts like option buttons)
>>>
>>>
>>>The dataset to the textbox would just be a binding source.
>>>
>>>But for the rest of them the data needs to cascade downward from the label array down to the TextBox.
>>>
>>>In c++ I could use pointers, but that doesn't seem advisable in c#
>>>
>>>I'm guessing that raising events is going to be my best solution, but was curious to find out if there was some way to do this that I had not though of.
>>>
>>>And, also if events are the way to go, what would be the best/most usual event to use?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform