大家好,新手请求帮助!

aiyeshu 2004-05-06 04:54:34
我刚开始学习ASP。NET,照书做实验,可总是不行。检查了好多遍,请大家帮我看看,谢谢!
==========================================
<script language="vb" runat="server">
Sub Page_Load()
Dim theNumber As Integer
Dim theGuess As Integer

theNumber=int(10*rnd)+1

If Request.Form("Guess")<>"" Then
theGuess=Request.Form("Guess")
If theGuess>theNumber then
Message.Text="<BR><BR>Guess is too high<BR>Try again-It was"_& theNumber
End If

If theGuess<theNumber then
Message.Text="<BR><BR>Guess is too low<BR>Try again-It was"_& theNumber
End If

If theGuess=theNumber then
Message.Text="<BR><BR>Guess is correct!"
End If
End If
End Sub
</script>

<html>
<head>
<title>If Then</tilte>
</head>
<body>
<form runat="server">
What number am I thinking of?
<asp:dropdownlist id="Guess" runat="server">
<asp:listitem>1</asp:listitem>
<asp:listitem>2</asp:listitem>
<asp:listitem>3</asp:listitem>
<asp:listitem>4</asp:listitem>
<asp:listitem>5</asp:listitem>
<asp:listitem>6</asp:listitem>
<asp:listitem>7</asp:listitem>
<asp:listitem>8</asp:listitem>
<asp:listitem>9</asp:listitem>
<asp:listitem>10</asp:listitem>
</dropdownlist>
<br>
<br>
<input type="submit" value="Submit guess">
<asp:label id="Message" runat="server"/>
</form>
</body>
</html>
...全文
133 3 点赞 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
aiyeshu 2004-05-06
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: System.Web.UI.WebControls.ListItemCollection must have items of type 'System.Web.UI.WebControls.ListItem'. 'br' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

Source Error:


Line 42: <asp:listitem>10</asp:listitem>
Line 43: </dropdownlist>
Line 44: <br>
Line 45: <br>
Line 46: <input type="submit" value="Submit guess">

  • 打赏
  • 举报
回复
aiyeshu 2004-05-06
不知道啊,书上是这么写的.看你回复后,我又加(runat="server"),也还是不行.
  • 打赏
  • 举报
回复
listhome 2004-05-06
错误信息?
你这是<input type="submit" value="Submit guess">也不是服务端控件呀?
  • 打赏
  • 举报
回复
相关推荐
发帖
.NET社区
加入

5.9w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2004-05-06 04:54
社区公告
暂无公告