dlist = new system.web.ui.webcontrols.dropdownlist() dlist.items.clear() dlist.id = "d" & rs2.fields("zdm").value
do while not rs3.eof dlist.items.add(rs3.fields(0).value) rs3.movenext() loop
td2.controls.add(dlist)
代码示例2: textbox textbox = new textbox(); textbox.id = showreader.getvalue(0).tostring(); this.controls.add(textbox);
代码示例3: // override to create repeated items. protected override void createchildcontrols() { object o = viewstate["numitems"]; if (o != null) { // clear any existing child controls. controls.clear();
int numitems = (int)o; for (int i=0; i < numitems; i++) { // create an item. repeateritem item = new repeateritem(i, null); // initialize the item from the template. itemtemplate.instantiatein(item); // add the item to the controlcollection. controls.add(item); } } }
备注 新控件添加到序号索引数组的末尾。控件可以是任何 asp.net 服务器控件、您创建的自定义服务器控件或文本控件的实例。