ASP.NET代码问题,求高手指教,我跟着书上打出来的,书上用的VS2005我用的VS2008和书上一摸一样却很多错!
<table><tr><td>NumberofLabels:</td><td><asp:DropDownListID="ddlLabels"runat="server">...
<table>
<tr>
<td>
Number of Labels:
</td>
<td>
<asp:DropDownList ID ="ddlLabels" runat = "server">
<asp : ListItem text = "0" value = "0" />
<asp : ListItem text = "1" value = "1" />
<asp : ListItem text = "2" value = "2" />
<asp : ListItem text = "3" value = "3" />
<asp : ListItem text = "4" value = "4" />
</asp: DropDownList>
</td>
</tr>
<tr>
<td>
Number of TextBoxes:
</td>
<td>
<asp: DropDownList ID = "ddlBoxes" runat = "server">
<asp: ListItem text = "0" value = "0" />
<asp: ListItem text = "1" value = "1" />
<asp: ListItem text = "2" value = "2" />
<asp: ListItem text = "3" value = "3" />
<asp: ListItem text = "4" value = "4" />
</asp: DropDownList>
</td>
</tr>
<tr>
<td colspan = 2>
</td>
</tr>
<tr>
<td>
<asp:System.Wev.UI.WevControls.CheckBox id ="chkHide" runat = "server" Text = "Hide Panel" />
</td>
<td>
<asp:Button ID = "Button1" runat = "server" Text = "Refresh Panel" />
</td>
</tr>
</table>
<hr/>
<h2>ScrollBars and Wrapping</h2>
<asp:Panel ID="pnlScroll" runat = "server"
Height = "200px"
Width = "90%"
GroupingText = "ScrollBars & Wrap">
<asp:Label ID="lblPanelContent" runat = "server"></asp:Label>
</asp:Panel>
<br />
<table>
<tr>
<td align = right>
ScrollBars:
</td>
<td>
<asp:DropDownList ID = ddlScrollBars runat = "server"
AutoPostback = true
OnSelectedIndexChanged = "ddlScrollBars_SelectedIndexChanged">
<asp:ListItem Text = "None" Selected = True />
<asp:ListItem Text = "Auto" />
<asp:ListItem Text = "Both" />
<asp:ListItem Text = "Horizontal" />
<asp:ListItem Text = "Vertical" />
</asp:DropDownList>
</td>
<td align = "right" >
Wrap:
</td>
错误 42“System.Web.UI.WebControls.ListItemCollection”内不允许包含文字内容(“<asp : ListItem text = "0" value = "0" /> 错误 23 未将对象引用设置到对象的实列。之类的。。还说我用<td><tr>也有问题。。求高手指教。。。 展开
<tr>
<td>
Number of Labels:
</td>
<td>
<asp:DropDownList ID ="ddlLabels" runat = "server">
<asp : ListItem text = "0" value = "0" />
<asp : ListItem text = "1" value = "1" />
<asp : ListItem text = "2" value = "2" />
<asp : ListItem text = "3" value = "3" />
<asp : ListItem text = "4" value = "4" />
</asp: DropDownList>
</td>
</tr>
<tr>
<td>
Number of TextBoxes:
</td>
<td>
<asp: DropDownList ID = "ddlBoxes" runat = "server">
<asp: ListItem text = "0" value = "0" />
<asp: ListItem text = "1" value = "1" />
<asp: ListItem text = "2" value = "2" />
<asp: ListItem text = "3" value = "3" />
<asp: ListItem text = "4" value = "4" />
</asp: DropDownList>
</td>
</tr>
<tr>
<td colspan = 2>
</td>
</tr>
<tr>
<td>
<asp:System.Wev.UI.WevControls.CheckBox id ="chkHide" runat = "server" Text = "Hide Panel" />
</td>
<td>
<asp:Button ID = "Button1" runat = "server" Text = "Refresh Panel" />
</td>
</tr>
</table>
<hr/>
<h2>ScrollBars and Wrapping</h2>
<asp:Panel ID="pnlScroll" runat = "server"
Height = "200px"
Width = "90%"
GroupingText = "ScrollBars & Wrap">
<asp:Label ID="lblPanelContent" runat = "server"></asp:Label>
</asp:Panel>
<br />
<table>
<tr>
<td align = right>
ScrollBars:
</td>
<td>
<asp:DropDownList ID = ddlScrollBars runat = "server"
AutoPostback = true
OnSelectedIndexChanged = "ddlScrollBars_SelectedIndexChanged">
<asp:ListItem Text = "None" Selected = True />
<asp:ListItem Text = "Auto" />
<asp:ListItem Text = "Both" />
<asp:ListItem Text = "Horizontal" />
<asp:ListItem Text = "Vertical" />
</asp:DropDownList>
</td>
<td align = "right" >
Wrap:
</td>
错误 42“System.Web.UI.WebControls.ListItemCollection”内不允许包含文字内容(“<asp : ListItem text = "0" value = "0" /> 错误 23 未将对象引用设置到对象的实列。之类的。。还说我用<td><tr>也有问题。。求高手指教。。。 展开
3个回答
展开全部
懂得ASPX标记是需要的,但照着书打ASPX标记绝不是好习惯,ASP.NET的优点之一就是可视化编程。
也就是说ASPX页面的标记都是由用户拖入控件并设置属性后生成的,需要编写代码的CS文件。
你的代码里的问题如下:
1、所有<asp:>标记中“:”的前后都不应加空格,如:<asp:ListItem text = "0" value = "0" />;
2、所有标记中的属性值都需要加西文双引号,如 <td colspan = "2">、<asp:ListItem Text = "None" Selected ="True" />等
3、<asp:System.Wev.UI.WevControls.CheckBox id ="chkHide" runat = "server" Text = "Hide Panel" />这句中的CheckBox不需要加类引用,应改为<asp:CheckBox id ="chkHide" runat = "server" Text = "Hide Panel" />
也就是说ASPX页面的标记都是由用户拖入控件并设置属性后生成的,需要编写代码的CS文件。
你的代码里的问题如下:
1、所有<asp:>标记中“:”的前后都不应加空格,如:<asp:ListItem text = "0" value = "0" />;
2、所有标记中的属性值都需要加西文双引号,如 <td colspan = "2">、<asp:ListItem Text = "None" Selected ="True" />等
3、<asp:System.Wev.UI.WevControls.CheckBox id ="chkHide" runat = "server" Text = "Hide Panel" />这句中的CheckBox不需要加类引用,应改为<asp:CheckBox id ="chkHide" runat = "server" Text = "Hide Panel" />
追问
老兄。。看你回答就是高手。。程序里说我的用有错。。哪儿错了啊。。
追答
忘了说上面的代码不完整,后面缺
展开全部
8283485555555575
追问
你什么意思。。不会别乱回答好不好。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
text = "0" 这个不对,值不对
更多追问追答
追问
书上的源码就是0
追答
你现在用的是2008,用08打开05编写的项目,是需要转换的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询