如何在不使用任何控件的情况下显示表中的数据 [英] how to show data from table without using any control
本文介绍了如何在不使用任何控件的情况下显示表中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请某人告诉我如何在不使用任何服务器控件的情况下从页面上显示数据...
Pls some one tell that how to show data from table on page without using any server control...
推荐答案
如果你不想使用任何服务器控件都可以在运行时创建HTML表来显示表数据。
由Haris编辑:已删除大写。
If you don''t want to use any server control than you can create HTML table at run-time to show table data.
edited by Haris: Caps removed.
可能有所帮助
在html表中显示数据 [ ^ ]
Hi chander_rani,
For perform this task you can use StringBulider class with his append function and write following code
StringBuilder stringBuilder= new StringBuilder();
stringBuilder.Append("<table>");
foreach(DataRow row in (yourtablename).Rows)
{
stringBuilder.Append("<tr>");
for (int i = 0; i < (yourtablename).Columns.Count; i++)
{
stringBuilder.Append("<td>"+row[i]+"</td>");
}
stringBuilder.Append("</tr>");
}
stringBuilder.Append("</table>");
试试这个,它将满足你的要求
最诚挚的问候,
Amit Vishwakarma
try this, it will fulfill your requirement
Best Regards,
Amit Vishwakarma
这篇关于如何在不使用任何控件的情况下显示表中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文