C# 调用代码:
<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeFile="Default.aspx.cs" Inherits="_Default" %>
protected void Page_Load(object sender, EventArgs e)
{
int i = 0;
int rowNum = 5;
DBcom mycom = new DBcom();
SqlDataReader sdr1 = mycom.GetProSubKind(1);
while (sdr1.Read())
{
this.Label1.Text = sdr1.GetString(3);
}
int kind = mycom.GetMobileKind();
SqlDataReader sdr = mycom.GetProList(kind);
System.Web.UI.WebControls.TableRow tr = new TableRow();
while (sdr.Read())
{
i = i + 1;
System.Web.UI.WebControls.TableCell tc = new TableCell();
pro_proCtl hts1 = (pro_proCtl)LoadControl("proCtl.ascx");
hts1.WebucId = sdr.GetInt32(0);
tc.Controls.Add(hts1);
tr.Controls.Add(tc);
if (i % this.rowNum == 0)
{
this.Table1.Rows.Add(tr);
tr = new TableRow();
}
else
{
this.Table1.Rows.Add(tr);
}
}
}