DropDownList控件,错哪了???

tiantian1980 tiantian1980 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
反复看几遍,还是不能运行,大家帮忙看看!先谢了!!!
<script language="C#" runat="server">
void Page_load(object src,EventArgs e)
{
DropDown1.Items.Add(new ListItem("ASP.Net区",“ASP.Net”));
DropDown1.Items.Add(new ListItem("JSP区",“JSP”));
DropDown1.Items.Add(new ListItem("PHP区",“PHP”));
DropDown1.Items.Add(new ListItem("VBVC区",“VBVC”));
DropDown1.Items.Add(new ListItem("HTML区",“HTML”));
}
void SubmitBtn_Click(object Sender,EventArgs e)
{
string SelectedText=DropDow1.SelectedItem.Text;
string SelectedValue=DropDow1.SelectedItem.Value;
Label1.Text="您选择的讨论区是:</font color=red>"+SelectedText+"<br></font>值为:<font color=red>"+SelectedValue+"</font>";
}
</script>
<html>
<head>
</head>
<body>
<b><font face="verdana">DropDownList示例</font></b>
<form ruant=server>
<asp:DropDownList id=DropDown1 runat="server"/>
<asp:button text="选择" Onclick="SubmitBtn_Click" runat=server/>
<p>
<asp:Label id=label1 font-size="10pt" runat="server">
请选择一个讨论区
</asp:Label>
</form>
</body>
</html>
报错是这样的:
Compiler Error Message: CS1026: ) expected
Source Error:
Line 4: DropDown1.Items.Add(new ListItem("ASP.Net区",“ASP.Net”));
...全文
评论 9
收藏 已收藏
分享
返回顶部
tiantian1980
.NET社区 62,272 成员 668,968 内容