Peter said:
Do you mean passing information in the constructor? You cannot since
ASP.NET instantiates the control for you and binds the tag with some
code-behind variable.
Either via the constructor or via properties. The problem is that the
UserControl that I placed on the page is not instantiated in the
code-behind file like a button control would be. So I am not sure about
how to even reference it.
For instance, the UserControl is called AddComments and my web page is
main.aspx.cs
I can't find anywhere in main.aspx.cs where AddComments is instantiated.
I can instantiate it manually like
AddComments oComment = new AddComments(...)
But ASP.NET doesn't seem to take into account anything I do with the
UserControl.
I guess, I need to have a reference to the instance of the UC that's in
use by ASP.NET.
You can however, use properties and methods to pass information in after it
is created, maybe in the Page_Load event. Or you can set attributes on the
page that get translated into property calls that ASP.NET sets.
Could you give me an example of this?