我正在尝试创建一个webpage
,但是当我创建一个并向它button
添加一个时,当我从按钮中删除它时它工作正常我尝试了这些步骤method
compilation error occurs
method
- 尝试删除页面,并从头开始重做
CS1061
在线查找错误
3.用不同的方法向按钮添加方法我已经筋疲力尽了,试着找出错误是什么,请帮助我!
Server Error in '/' Application.
Compilation Error
说明:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。
编译器错误消息:CS1061:“ASP.usermodification_aspx”不包含“btnModify_Click”的定义,并且找不到接受“ASP.usermodification_aspx”类型的第一个参数的扩展方法“btnModify_Click”(您是否缺少 using 指令或装配参考?)
Source Error:
Line 38: SelectCommand="SELECT RoleName FROM aspnet_Roles"></asp:SqlDataSource>
Line 39: <br />
Line 40: <asp:Button ID="btnModify" runat="server" Text="Modify"
Line 41: onclick="btnModify_Click" />
Line 42:
namespace RentACar
{
public partial class UserModification : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnModify_Click(object sender, EventArgs e)
{
GridViewRow row = gvUserRoles.SelectedRow;
string username = row.Cells[0].Text;
string role = row.Cells[1].Text;
Roles.RemoveUserFromRole(username, role);
string choosenrole = dllUserRoles.SelectedValue.ToString();
Roles.AddUserToRole(username, choosenrole);
}
}
}`
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="UserModification.aspx.cs" Inherits="RentACar.UserModification" %>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<asp:Button ID="btnModify" runat="server" Text="Modify"
onclick="btnModify_Click" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;