两个文件:Default7.aspx Default7.aspx.cs
Default7.aspx文件代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="Red">红色</asp:ListItem>
<asp:ListItem Value="Blue">蓝色</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>Default7.aspx.cs文件代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default7 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
void SelectedIndexChanged(Object sender, EventArgs e)
{
Label1.Text = DropDownList1.SelectedItem.Value; }
}为什么一运行提示:
Source Error:
Line 10: <form id="form1" runat="server">
Line 11: <div>
Line 12: <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="SelectedIndexChanged" AutoPostBack="True">
Line 13: <asp:ListItem Value="Red">红色</asp:ListItem>
Line 14: <asp:ListItem Value="Blue">蓝色</asp:ListItem>
那有问题呀,各位大侠帮帮忙呀!谢谢!!
Default7.aspx文件代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default7.aspx.cs" Inherits="Default7" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="Red">红色</asp:ListItem>
<asp:ListItem Value="Blue">蓝色</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>Default7.aspx.cs文件代码:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default7 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
void SelectedIndexChanged(Object sender, EventArgs e)
{
Label1.Text = DropDownList1.SelectedItem.Value; }
}为什么一运行提示:
Source Error:
Line 10: <form id="form1" runat="server">
Line 11: <div>
Line 12: <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="SelectedIndexChanged" AutoPostBack="True">
Line 13: <asp:ListItem Value="Red">红色</asp:ListItem>
Line 14: <asp:ListItem Value="Blue">蓝色</asp:ListItem>
那有问题呀,各位大侠帮帮忙呀!谢谢!!
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0122: 'Default7.SelectedIndexChanged(object, System.EventArgs)' is inaccessible due to its protection levelSource Error: Line 10: <form id="form1" runat="server">
Line 11: <div>
Line 12: <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="SelectedIndexChanged" AutoPostBack="True">
Line 13: <asp:ListItem Value="Red">红色</asp:ListItem>
Line 14: <asp:ListItem Value="Blue">蓝色</asp:ListItem>
Source File: d:\net\coder\Code3-1\Default7.aspx Line: 12 Show Detailed Compiler Output:
D:\Microsoft Visual Studio 8\Common7\IDE> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\code3-1\48e734b2\6d384d9b\App_Web_kzkpgp70.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699 "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\code3-1\48e734b2\6d384d9b\App_Web_kzkpgp70.0.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\code3-1\48e734b2\6d384d9b\App_Web_kzkpgp70.1.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\code3-1\48e734b2\6d384d9b\App_Web_kzkpgp70.2.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\code3-1\48e734b2\6d384d9b\App_Web_kzkpgp70.3.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\code3-1\48e734b2\6d384d9b\App_Web_kzkpgp70.4.cs"
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.d:\net\coder\Code3-1\Default5.aspx(15,74): error CS0122: 'Default5.SelectedIndexChanged(object, System.EventArgs)' is inaccessible due to its protection level
d:\net\coder\Code3-1\Default5.aspx.cs(39,10): (Location of symbol related to previous error)
d:\net\coder\Code3-1\Default7.aspx(12,74): error CS0122: 'Default7.SelectedIndexChanged(object, System.EventArgs)' is inaccessible due to its protection level
d:\net\coder\Code3-1\Default7.aspx.cs(18,10): (Location of symbol related to previous error)