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 8277177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:36:40+00:00 2026-06-08T08:36:40+00:00

I have set up a page with a submit button that the user can

  • 0

I have set up a page with a submit button that the user can click and log in. I need to gather the field values and then do some backend stuff, but when the button is clicked, the even handler method I have set up doesn’t fire. Heres the button code:

<asp:Button UseSubmitBehavior="false" CssClass="btn btn-primary" ID="btnTest" runat="server" Text="Submit" OnClick="btnTest_Click" />

And the codebehind:

public partial class SignIn : System.Web.UI.Page
{
    protected void Page_Load(Object sender, EventArgs e)
    {
        btnTest.Click += new EventHandler(this.btnTest_Click);
    }

    protected void btnTest_Click(Object sender, EventArgs e)
    {
        string user = username.Value;
        string pass = password.Value;
        int userid = -1;
        RoomSvc.Data.Person[] persons = RoomService.Service.ServiceClient.GetPersons();
        RoomSvc.Data.Person pUser = null;
        foreach (RoomSvc.Data.Person p in persons)
        {
            if (p.username == user && p.password == pass)
            {
                pUser = RoomService.Service.ServiceClient.GetPerson(userid.ToString());
            }
            else
            {
                return;
            }
        }
        RoomService.Global.currentUser = pUser;
    }
}

I have tried everything out there and nothing is making it work, could someone please enlighten.

EDIT: .aspx code:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="SignIn.aspx.cs" Inherits="RoomService.Account.SignIn" %>



   <asp:Content ID="SignInHeader" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
    <asp:Content ID="SignInContent" ContentPlaceHolderID="MainContent" runat="server">
        <form action="SignIn.aspx" class="form-horizontal well span5 offset5">
            <fieldset>
              <legend>Sign In</legend>
              <div class="control-group">
                <label class="control-label" for="input01">Username</label>
                <div class="controls">
                  <input runat="server" type="text" class="input-medium" id="username" />
                </div>
              </div>
              <div class="control-group">
                <label class="control-label" for="input01">Password</label>
                <div class="controls">
                  <input runat="server" type="text" class="input-medium" id="password" />
                </div>
              </div>
              <div class="form-actions">
                <asp:Button CssClass="btn btn-primary" ID="btnTest" runat="server" Text="Submit" OnClick="btnTest_Click" />
              </div>
            </fieldset>
        </form>
    </asp:Content>
  • 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-08T08:36:42+00:00Added an answer on June 8, 2026 at 8:36 am

    I figured it out.

    I had to add the even handler in Page_Init() not Page_Load()

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

Sidebar

Related Questions

I have created registration page and when user click submit button, an activation link
So, I have set up a login page that verifies the user's credentials, and
I have set the Masonry demo on this page . I see that the
I have set permission to allow anonymous user to create page. but when the
I recently discovered that when you have a page set to session readonly and
I have a button on a page with an onClick I dynamically set via
Currently I have a set of fields on a page. When the button is
The set up is when the user arrives on the page, it will have
I have some jquery/php interaction set up on a page. It submits some data
I have a page set up to show only posts from one category, which

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.