DropDownList控件,错哪了???
反复看几遍,还是不能运行,大家帮忙看看!先谢了!!!
<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”));
<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”));
...全文
相关推荐
asp.net中DropDownList控件的二级联动
asp.net(C#)中DropDownList控件的二级联动,两种方法,第一种为普通方法,第二种为从数据库绑定DropDownList的。
ASP.NET中DropDownList下拉框列表控件绑定数据的4种方法
本文主要介绍了DropDownList控件4种绑定数据的基础用法,希望对大家能有所帮助。
datalist控件中使用DropDownList
datalist控件中使用DropDownList
扩展DropDownList控件和ListBox控件
扩展DropDownList控件和ListBox控件扩展DropDownList控件和ListBox控件扩展DropDownList控件和ListBox控件
Dropdownlist控件的使用
选择省的同时选中对应的市,选择男时对应选中男头像。。。。。。


