calling a procedure of user control from aspx file

Hi VB.Net Users,

I have written a procedure in the user control. I need to call that procedure from aspx file. I had created an object for it, but still not able to call that property.

Can any one guide me to get a solution for this.

I am getting the error "Object Reference has the value Nothing"Drag your UserControl on the aspx page.
If you are using Visual Studio, a decaration like this will appear in your code behind page:

Protected UserControl1 as YourUserControl

In Page_Load, call your procedure like this:

UserControl1.YourProcedure = something

or

something = UserControl1.YourProcedure

or just

UserControl1.YourProcedure

Make sure you set to New in your UserControl all the objects used in the procedure before using them , and make sure your procedure is Public.
 
Back
Top