DataList的问题!
我想请问下各位大侠: 当点击一个 “添加”按钮 时,我想要添加一行DataList
请问怎么实现啊?
我是这么写的 但是没有效果 是怎么回事啊?
//dlProtect_pwd是DataList控件的ID
TextBox txtBox_Ques = (TextBox)dlProtect_pwd.Items[0].FindControl("TxtQuestion");
TextBox txtBox_Answ = (TextBox)dlProtect_pwd.Items[0].FindControl("TxtAnswer");
Label lb_Ques = (Label)dlProtect_pwd.Items[0].FindControl("LblQuestion");
Label lb_Answ = (Label)dlProtect_pwd.Items[0].FindControl("LblAnswer");
// int number = dlProtect_pwd.Items.Count;
DataListItem dli = new DataListItem(0, ListItemType.Item);
dli.Controls.Add(lb_Ques);
dli.Controls.Add(txtBox_Ques);
dli.Controls.Add(lb_Answ);
dli.Controls.Add(txtBox_Answ);
this.dlProtect_pwd.Controls.Add(dli);
[ 本帖最后由 hhy420459674 于 2010-5-20 13:52 编辑 ]