Where sequencelabelid is the ID number of the component to use, the Myplaceholder.findcontrol () method returns the object of type control, using (Label) to cast the type to the label type. Then you can do whatever you need to do with this object you want to operate. such as changing the properties of a component, and so on.
A special note is that using the above statement to use a dynamically created Web component has the premise that the page cannot be refreshed. If the page is refreshed and you do not re-create the component after the page has been refreshed. Use the above statement in your program to use a dynamically created Web component, and you will get an error while the program is running. This error occurs because the dynamically created Web Component does not exist after the page has been refreshed. There is such a problem in the author's procedure. Because the author of the process of thinking is
1. Read XML file
2. Dynamically create Web Components based on read information and assign values to their text properties
3. Allows users to modify the text properties of a dynamically created Web component.
4, after the user submits the modification, wants to write the modified attribute to the XML file
However, when the user submits the change, the page is refreshed. So how do you get the modified attributes?
The author uses the following method in the program:
Where nametbid is the ID number of the Web Component to use. When the page is refreshed, although the dynamically created Web Component does not exist, the request object has saved the information for the Web component, so you can still get the modified information.
If you want to still display the dynamically created Web component after the page is refreshed, you need to invoke the function that created the Web Component again in Page_Load (object sender, System.EventArgs e) and use Request.form[id] Assign the modified value to the corresponding component. Keep in mind that the function that creates the Web component is placed in the IF (IsPostBack) {}.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service