I have a situation where I add several controls at runtime. I do:
placeholder.Controls.Add(theaddedcontrol);
开发者_JAVA技巧When I collect input from the page, I do not know how to access the added controls for their values.
Any suggestions?
Use the following structure:
Control control = (Control) placeHolder.FindControl("ControlName");
Object targetProperty = control.//Target Property ...
Refer to Control.FindControl Method
You'll need to use the Control.FindControl
method.
You can find more information on how to use this over at MSDN
精彩评论