Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7886983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:27:40+00:00 2026-06-03T05:27:40+00:00

I am trying to create a webpage , but when i create a button

  • 0

I am trying to create a webpage, but when i create a button and add a method to it a compilation error occurs, when i remove the method from the button it work fine
i tried these steps

  1. tried delete page, and redo it from from beginning
  2. find the error CS1061 online

3.adding method to button with different methods
i am exhausted try to find what is the error pls help me!

  Server Error in '/' Application.

    Compilation Error

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: CS1061: ‘ASP.usermodification_aspx’ does not
contain a definition for ‘btnModify_Click’ and no extension method
‘btnModify_Click’ accepting a first argument of type
‘ASP.usermodification_aspx’ could be found (are you missing a using
directive or an assembly reference?)

    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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:27:42+00:00Added an answer on June 3, 2026 at 5:27 am

    Try using CodeFile instead of CodeBehind in page tag. CodeBehind requires the solution to be compiled. There could be something wrong in your code. After using CodeFile attribute in the page tag, put a break point on your button event handler and see if you still get that error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a Java Application that retrieves information from a webpage.
I am trying to create something on a webpage that allows my users to
I am trying to make a webpage with Ajax. Example: I create a Perl/CGU
I am trying create a delegate representation of constructor by emitting a Dynamic Method,
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
Trying to create a background-image slideshow and am getting this error... This is the
I'm trying to create a greasemonkey script (for Opera) to add autocomplete to input
I am trying to create a webpage which perfectly fits on the screen of
I am trying to create a textbox watermark using javascript but with the current
I have a AJAX/Javascript intensive webpage and is trying to create a static version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.