Asp.net| Programming | controls
Today I used the user control in 2.0 and found that using the user control programmatically was quite different from the 1.X.
1. First, you want to declare a reference in the page header you want to use.
As follows:
<%@ Reference control= ". /controls/albumeditor.ascx "%>
2, in the post code, from the "ASP" space can be found in the control's class reference, but also need an example.
-_-! Do not understand why the designer to do so, but not as intuitive as 1.1.
As follows:
Asp. Controls_albumeditor Albumediror = (ASP. Controls_albumeditor) LoadControl (".. /controls/albumeditor.ascx ");
Albumediror.editalbumid=e.commandargument.tostring ();
This is a relatively complete reference.
than 1. The benefit of X should be that the class that is generated by the custom user control will not be affected by the development.
Such a strong type of reference, personal feeling or trouble point! -_-!!
It's not cool to write code!