欢迎大家光临【无师自通-教程网】您的到来是我们的荣幸。本站提供photoshop教程,ps教程,flash教程,cad教程,网页制作教程,excel教程,asp教程,vb教程,3d教程,c语言教程,html教程,coreldraw教程,dreamweaver教程,java教程,3dmax教程 等各种教程为主题的内容和服务,相信您会在这里找到您所需要的东东。无师自通伴您一生-谢谢您的光临!!
网站地图 设为首页
简繁切换 加入收藏
栏目待定 留言本站
您现在的位置: 无师自通-教程网 >> WEB开发 >> ASP.NET教程 >> ASP.NET技巧 >> 教程正文

  没有公告

教程: ASP.NET教程-.NET技巧-动态生成asp.net控件 更多...
教程: ASP.NET教程-.NET技巧-动态生成asp.net控件
public void CreateDataGrid()
{
DataTable flowTable=new WorkFlowBLL().GetFlowTableByCode(FunctionCode);
foreach(DataRow dataRow in flowTable.Rows)
{
Table table=new Table();
table.CellPadding=0;
table.CellSpacing=0;
table.Width=Unit.Percentage(98);
table.Attributes.Add("align","center");
table.Attributes.Add("style","HEIGHT:expression(document.body.offsetHeight-ToolBar.offsetHeight-SpaceBar.offsetHeight-33)");
table.CssClass="plPanelUnSelect";
table.Attributes.Add("ImagesSrc","images/contact.gif");
table.Attributes.Add("PanelCaption",(string)dataRow["BMC"]);
TableRow tableRow=new TableRow();
TableCell tableCell=new TableCell();
tableCell.VerticalAlign=VerticalAlign.Top;
Panel panel=new Panel();
panel.Attributes.Add("style","OVERFLOW: auto; WIDTH: 100%; HEIGHT: 100%");
dataGrid=new DataGrid();
dataGrid.BorderWidth=0;
dataGrid.ID=(string)dataRow["BDM"];
dataGrid.EnableViewState=false;
dataGrid.Width=Unit.Percentage(100);
dataGrid.Font.Size=FontUnit.Parse("12px");
dataGrid.Style["border-collapse"]="none";
dataGrid.ItemDataBound = new DataGridItemEventHandler(dataGrid_ItemDataBound);
dataGrid.DataSource=new WorkFlowBLL().GetFlowDataByCode(FunctionCode,(string)dataRow["BDM"],DataCode);
dataGrid.DataBind();
panel.Controls.Add(dataGrid);
tableCell.Controls.Add(panel);
tableRow.Cells.Add(tableCell);
table.Rows.Add(tableRow);
placeHolder.Controls.Add(table);
}
}
private void dataGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if ((e.Item.ItemType==ListItemType.Item)||(e.Item.ItemType==ListItemType.AlternatingItem))
{
HtmlInputText InputText=new HtmlInputText();
InputText.Attributes.Add("class","clsinput");
InputText.Value= e.Item.Cells[1].Text;
//getFlowWrite
e.Item.Cells[1].Controls.Add(InputText);
}
for (int i=0;i {
if (e.Item.ItemType==ListItemType.Header)
{
e.Item.Cells[i].Attributes.Add("class","irTitle");
}
else{
e.Item.Attributes.Add("class","irBody");
e.Item.Attributes.Add("overClassName","irBodyOver");
e.Item.Attributes.Add("cssClick","irBodyClick");
}
e.Item.Cells[i].Attributes.Add("align","center");
e.Item.Cells[i].Attributes.Add("Width",Convert.ToString(100/e.Item.Cells.Count) "%");
e.Item.Cells[i].Attributes.Add("nowrap","true") ;
}
}


教程录入:admin    责任编辑:admin 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
     
     
     
     

    asp连接mysql数据库

    asp连接mysql数据库-2

    frontpage2000教程---制作主页
    免责声明!本站资料大部分来自于互联网,其版权归原作者或其他合法者所有.如内容涉及或侵犯了您的权益,请通知本人,我将尽快处理!.欢迎您的光临。
    辽ICP备07003958号
    无师自通,伴你一生-教程网