本案例以给Literal控件批量赋值为例,同理,可为label、textbox等控件批量赋值 首先在前台将需要批量赋值的控件Literal的id设置成一定的规律,例如:Literal1、Literal2、Literal3、Literal4、Literal5....
以label控件为例: int LabelCount = GetLabelCount(this);//获取Literal控件在本页面的数量 private int GetLabelCount(System.Web.UI.Control
在DAl层中添加一下引用: 添加引用: using System.Web.Configuration; web.config中连接数据库的字符串: 获得web.config中连接数