Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to reference a control in user control?
Message
 
 
À
04/02/2010 08:59:02
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01447396
Message ID:
01447458
Vues:
29
>>>>Hi,
>>>>
>>>>I need to set DataSource of a text box to a table in a data set. The text box actually is part of a user control. For example,
>>>>user control: MyUserControl textbox: txtMyEntry
>>>>
>>>>I tried to reference using
>>>>
>>>>MyUserControl.txtMyEntry but it does not work.
>>>>
>>>>
>>>>Any suggestions? TIA.
>>>
>>>Don't you need a property such as .Value?
>>
>>The problem is that the control txtMyEntry is not recognized. Therefore you can't use any properties (get or set) of the text box. I think that to "expose" properties of the txtMyEntry textbox I need to do some coding in one of the methods of the user control (container). But I don't know what and not finding any articles on the web. I have a book where the author say it can be done and you can see it in the accompanied code to the book. But I can't find where to download the source for the book either.
>
>If the txtMyEntry is showing as available then you need to add public properties or methods for them to be available. You could add something as a test to make sure it shows up.
>
>If the txtMyEntry is not showing up in intellisense then make sure to add the using statment for the namespace you have in MyUserControl. Also if it is in a different assembly, make sure you have added it as a reference.
>
>There are lots of examples out there for subclassed controls so if you don't find something let me know and I will send you some. I know Bonnie has posted examples before also.
>Tim

I will work on the suggestions you made. Thank you very much.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform