asp.net user control
Posted on 2005-04-14
Suppose my asp.net application is designed such that I create several user controls.
Lets say I have some user control, PaymentMethodUserControl which I drag and drop into my startup form.
How do I reference the elements of PaymentMethodUserControl1 within the context of the startup form?
for example, I would like to do something like this within the context of the startup form (the form in which I dragged the user control):
if Me.PaymentMethodUserControl1.radioButtonCash.checked = true then.... [this logic could, for example, be in the click event of some button within the startup form]
Of course, the above does not work (not even if you change the code of PaymentMethodUserControl, such that all the radio buttons are made public instead of protected).
I get the following error:
Object reference not set to an instance of an object (PaymentMethodUserControl1).