本来使用非常正常,然后刚刚点击调试突然就出现了错误。
错误提示信息如下:错误 30 “HTML_Welcomepage”不包含“LabelName”的定义,并且找不到可接受类型为“HTML_Welcomepage”的第一个参数的扩展方法“LabelName”(是否缺少 using 指令或程序集引用?) D:\net实训\HTML\Welcomepage.aspx.cs 27 18 net实训
下面是代码
Welcomepage.aspx:
//这段代码第一个<td>就是建了个表格然后第一格式标题姓名
<tr>
<td class="auto-style2" style="font-family:幼圆"><CENTER><strong>姓名:</strong></CENTER>
</td>
//第二个td是点击VIsual studio 工具箱里的标准Lable控件建成的
<td class="auto-style3" style="font-family:幼圆;background-color:white;text-align:center ">
<asp:Label ID="LabelName" runat="server" Text="无"></asp:Label>
</td>
</tr>
Welcomepage.aspx.cs:
//这个是在数据库中查询信息
command.CommandText = string.Format("select TName from L_C.tb_TeacherInfo where TId='{0}'", Session["ID"].ToString());
//这个是把查询到的信息放在Lable中
this.LabelName.Text = command.ExecuteScalar().ToString();
有很多上述这样的应用,不知道是不是太多的问题
下面是几张图片因为应用很多我就随便截了几张
Welcomepage.aspx:
Welcomepage.aspx.cs:
错误提示信息:
**有试着删掉出问题的Label 然后重新添加但是在.CS界面 this.后面不显示出来 **