关于引用的奇怪情况

JS 2014-07-08 05:31:42
http://msdn.microsoft.com/zh-cn/magazine/system.web.ui.htmlcontrols.htmltablerow.htmltablerow(VS.80).aspx
连接中的c#部分中void Page_Load(Object sender, EventArgs e)放在aspx页面中没有任何问题,放在aspx.cs文件中(添加了using System.Web.UI.HtmlControls;)缺报错cellpadding、row、Border没有引用,但是查看了msdn
http://msdn.microsoft.com/zh-cn/library/System.Web.UI.HtmlControls.HtmlTable(v=vs.110).aspx
就是引用的HtmlControls啊,怎么还提示缺少引用呢?请高手指点一下,多谢了。
...全文
230 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
JS 2014-11-07
  • 打赏
  • 举报
回复
解决了,谢谢大家。
geyewei 2014-07-11
  • 打赏
  • 举报
回复
利用VS2008实验了一下。执行起来以后显示了一个五行四列的表格。把我的代码贴出啦,跟你的步骤不一样的地方,就用红色来表示了。 Default.aspx <%@ Page Language="C#" AutoEventWireup="True" CodeFile="Default.aspx.cs" Inherits="_Default" %> <script runat="server" > </script> <html> <head> <title>HtmlTable Example</title> </head> <body> <form id="Form1" runat="server"> <h3> HtmlTable Example </h3> <asp:PlaceHolder id="Place" runat="server"/> </form> </body> </html> Default.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // Create an instance of an HtmlTable control. HtmlTable table = new HtmlTable(); table.Border = 1; table.CellPadding = 3; // Populate the HtmlTable control by adding rows to it. for (int rowcount = 0; rowcount < 5; rowcount++) { // Create a new HtmlTableRow control. HtmlTableRow row = new HtmlTableRow(); // Add cells to the HtmlTableRow control. for (int cellcount = 0; cellcount < 4; cellcount++) { // Define a new HtmlTableCell control. HtmlTableCell cell; // Create table header cells for the first row. if (rowcount <= 0) { cell = new HtmlTableCell("th"); } else { cell = new HtmlTableCell(); } // Create the text for the cell. cell.Controls.Add(new LiteralControl( "row " + rowcount.ToString() + ", " + "column " + cellcount.ToString())); // Add the cell to the HtmlTableRow Cells collection. row.Cells.Add(cell); } // Add the row to the HtmlTable Rows collection. table.Rows.Add(row); } // Add the control to the Controls collection of the // PlaceHolder control. Place.Controls.Clear(); Place.Controls.Add(table); } }
ZhangNan20100811 2014-07-11
  • 打赏
  • 举报
回复
贴上来看看。。。
  • 打赏
  • 举报
回复
你的aspx.cs和aspx页面之间关联了吗?
wuyq11 2014-07-11
  • 打赏
  • 举报
回复
框架是?写出代码看看
RainBow_24 2014-07-11
  • 打赏
  • 举报
回复
用table点一下,看看都有什么属性?
save4me 2014-07-10
  • 打赏
  • 举报
回复
你大小写注意了吗?另外,这几个属性在代码的自动完成里面有没有,就是在VS里面你输入table.的时候出现的下拉列表里面有没有?
JS 2014-07-08
  • 打赏
  • 举报
回复
在线等高人路过呀。。。
JS 2014-07-08
  • 打赏
  • 举报
回复
没有知道的么

62,242

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧