<Div id = "textboxs" runat = "server">
<Asp: textbox id = "COM1" runat = "server"> </ASP: textbox>
<Asp: textbox id = "com2" runat = "server"> </ASP: textbox>
<Asp: textbox id = "com2" runat = "server"> </ASP: textbox>
</Div>
Assume that the storage method of the comname field in the database is: "image, book, tutorial" with a bean number in the middle
String [] comarray = Dr ["comname"]. tostring (). Split (',');
Foreach (INT I = 0; I <comarray. lenth; I ++)
{
(Textbox) This. textboxs. findcontrol ("com" + (I + 1). tostring (). Text = comarray [I]. tostring ();
}
Okay, now it's done,
Note:When using findcontrol, you must add a container outside the closest to the search object. If you directly use this. findcontrol or page. findcontrol, it will often appear.Object not set to instanceSo it is best to add a container, then the DIV added here is a container, in order to make findcontrol find the name COM1, com2 In the DIV whose ID is "textboxs, textbox of com3;