using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using yihan.Data; public partial class monitor_monitor_group_class_list : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = new DataTable(); string resultString = ""; string sql = "select * from monitor_group order by orderby desc,monitor_grp_id"; DbConn conn = new DbConn(); dt = conn.DataTable(sql); Literal1.Text = myDataBind.GetTree_monitor_grp_id(dt, 0, ref resultString); //调用 dt.Dispose(); conn.Close(); } } }
class_list.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="class_list.aspx.cs" Inherits="monitor_monitor_group_class_list" %> <body> <form runat="server"> <table cellpadding="0" cellspacing="1" bgcolor="#66AADD"> <tr bgcolor="#999999"> <th bgcolor="#BAD8EF">监视器组名称</th> <th bgcolor="#BAD8EF">级别</th> <th bgcolor="#BAD8EF">子节点总数</th> <th bgcolor="#BAD8EF">操作</th> </tr> <tr> <td colspan="5">监视器组</td> </tr> <asp:Literal runat="server"></asp:Literal> </table> </form> </body>
手写Table
string s="<table>" s+="<tr><td>"; s+=变量值; s+="</td></tr></table>"; ResPonse.Write(s);
至于循环及其其他的方法自己构造
更多关于asp.net相关内容感兴趣的读者可查看本站专题:《asp.net文件操作技巧汇总》、《asp.net ajax技巧总结专题》及《asp.net缓存操作技巧总结》。