更新时间:2023-09-29 19:48:34
看看 MSDN文章 [
Hi,
Have a look at MSDN Article[^]
You can create any server control or html control dynamically. You can also add your dynamically created control in your page. you only need to create an instance of that control and add in the page with data.
Good luck.
Thanks
-Amit Gajajr
看看这些链接..您将了解如何根据数据库值创建动态表.
http://www.aspdotnet-suresh.com/2012/07/aspnet-save-dynamically-created-control.html [ ^ ]
http://www.dotnetcurry.com/ShowArticle.aspx?ID=135 [ ^ ]
http://***.com/questions/9835209/creating- a-dynamic-custom-datagrid-using-table-and-label [
Have a look these links..you will have an idea how to create dynamic table depending on database values.
http://www.aspdotnet-suresh.com/2012/07/aspnet-save-dynamically-created-control.html[^]
http://www.dotnetcurry.com/ShowArticle.aspx?ID=135[^]
http://***.com/questions/9835209/creating-a-dynamic-custom-datagrid-using-table-and-label[^]
在.aspx页上执行html表控件,并在.cs页面.
Take html table control on .aspx page and write below code on .cs page.
DataTable DT = new DataTable();
//Your DT biding code goes here
HtmlTableRow TR;
HtmlTableCell TD;
//You can Iterate loop here to check ur logic i.e.until the value becomes zero
if (DT.Rows.Count>0)
{
TR = new HtmlTableRow();
TD = new HtmlTableCell();
TD.InnerHtml = " Branch Code";
TD.Align = "Left";
TD.Style[HtmlTextWriterStyle.FontSize] = "11px";
TR.Cells.Add(TD);
tblRpt.Rows.Add(TR);
TD = new HtmlTableCell();
TD.InnerHtml = " Branch Name";
TD.Align = "Left";
TD.Style[HtmlTextWriterStyle.FontSize] = "11px";
TR.Cells.Add(TD);
tblRpt.Rows.Add(TR);
TD = new HtmlTableCell();
TD.InnerHtml = " Branch State";
TD.Align = "Left";
TD.Style[HtmlTextWriterStyle.FontSize] = "11px";
TR.Cells.Add(TD);
tblRpt.Rows.Add(TR);
}
谢谢!!!
祝您编码愉快!!!! :)
Thanks!!!
Happy Codeing!!!!! :)