是我的vs编译器出问题了吗?
kecheng.aspx----------------
<div style="width:700px;">
<div style="float:left; width:300px; background:#f00;">
<div id="show3d" runat="server">
</div>
</div>
</div>
kecheng.aspx.cs------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class kecheng : System.Web.UI.Page
{
SqlConnection myconn;
protected void Page_Load(object sender, EventArgs e)
{
myconn = new SqlConnection(ConnStr.GetConnectionStrings());
//this.show3d.Controls.Add(new LiteralControl("<TABLE class=show cellSpacing=0 cellPadding=0><TBODY><TR><TD class=show_1>d</TD><TD class=show_2>fdgdsfg</TD><TR><TR><TD class=show_1>d</TD><TD class=show_2>fdgdsfg</TD><TR><TR><TD class=show_1>d</TD><TD class=show_2>fdgdsfg</TD><TR><TR><TD class=show_1>d</TD><TD class=show_2>fdgdsfg</TD><TR><TR><TD class=show_1>d</TD><TD class=show_2>fdgdsfg</TD><TR></TR></TBODY></TABLE>"));
ShowClass1();
}
protected void ShowClass1()
{
string sqlselect = "select top 3 * from [Class]";
DataSet myds = new DataSet();
SqlDataAdapter mysda = new SqlDataAdapter(sqlselect, myconn);
mysda.Fill(myds,"class");
string li = "";
for(int i = 0; i <= myds.Tables["class"].Rows.Count-1; i++)
{
li += "<li>" + myds.Tables["class"].Rows[i]["C_title"].ToString() + "";
}
this.show3d.Controls.Add(new LiteralControl("<ul>" + li + "</ul"));
}
}
获取的效果:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0033)http://localhost/hz1/kecheng.aspx -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<FORM id=form1 name=form1 action=kecheng.aspx method=post>
<DIV><INPUT id=__VIEWSTATE type=hidden
value=/wEPDwUKLTk3NTAwMzQ3NWRkPHdya/c2tM+hJFfSRcwTdcQo1N4= name=__VIEWSTATE>
</DIV>
<DIV style="WIDTH: 700px">
<DIV style="BACKGROUND: #f00; FLOAT: left; WIDTH: 300px">
<DIV id=show3d>
<UL>
<LI>d
<LI>d
<LI>d</UL>
< div> </LI></UL></DIV></DIV></FORM></DIV></BODY></HTML>
郁闷!!!! 兄弟们遇见过没?