1.ViewCustomerServiceInvoice theViewCustomerServiceInvoice = ViewCustomerServiceInvoiceManager.Instance.ToEntity((e.Item.DataItem as DataRowView).Row);
如何获取到DataTable中的行。
2.foreach(Question currentQuestion in lstQuestion)
{
foreach(Quarter currentQuarter in lstQuarter){
string id = string.Format("txtAnswer_{0}_{1}", currentQuestion.ID, currentQuarter.ID);
}
}如何动态生成文本框的ID。
3. Stopwatch theStopwatch = new Stopwatch();声明开始时间(单位:毫秒),
theStopwatch.Start();开始计算时间(单位:毫秒),
PageHelper.Alert("BindCustomerAttenderGridView:" + theStopwatch.ElapsedMilliseconds);弹出对应项目的执行时间,
theStopwatch.Stop();停止计算时间(单位:毫秒),
PageHelper.Alert(theStopwatch.ElapsedMilliseconds);弹出从开始到结束所用的时间(单位:毫秒)。
4.动态创建DataTable:
HtmlTableRow htrHeader = new HtmlTableRow(); 声明一行第一行
HtmlTableCell htcMainIndicatorCategory = new HtmlTableCell();声明第一行的第一格;
htcMainIndicatorCategory.InnerText = "主分类"; 进行 TableCell 的赋值,
htrHeader.Cells.Add(htcMainIndicatorCategory); 将这一行的这一格数据添加到DataTable中;
HtmlTableCell htcSubIndicatorCategory = new HtmlTableCell();声明第一行的对应格的数据,
htcSubIndicatorCategory.InnerText = "子分类";将第一行的对应格进行赋值,
htrHeader.Cells.Add(htcSubIndicatorCategory);将对应数据插入对应格;
foreach (SysUserLevel currentSysUserLevel in lstSysUserLevel) 通过循环获取对应Cell的所需要的值
{
HtmlTableCell htcemployees1 = new HtmlTableCell(); 声明一个Cell
htcemployees1.InnerText = currentSysUserLevel.EnglishName; 将循环出来的值给到对应的Cell中
htrHeader.Cells.Add(htcemployees1);将Cell的值赋给这一行。
}
this.tbIndicatorWeight.Rows.Add(htrHeader);将所有的Cell的值赋给行之后再绑定到DataTable中。