Loading ...

Event Handlers

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  getting started / general asp.net   » Event Handlers

Event Handlers

Posts under the topic: Event Handlers

Posted: 11/25/2011

mk781
m k
Lurker 20  points  Lurker
  • Joined on: 11/25/2011
  • Posts: 4

HI,

I'm a newbie so if the question is selly then sorry !

 

When I create a button using Visual Studio's Design view and then double click it , an event handler with an empty body is created.  as example is shown below

protected void Button1_Click (object sender, EventArgs e)

{

}

 

BUT sometimes it gets created in the aspx file (i don't know why its sometimes different) and even

though I delete the method in the aspx file it not execute the method in the cs file. BUT I want to use the method in the cs file and force it

to use only that.

Any help would be appreciated.Thanks!


Posted: 11/27/2011

Guru 16813  points  Guru
  • Joined on: 4/19/2009
  • Posts: 490

You need to check the CodeBehind attribute of your ASPX Page directive. It should be like CodeBehind="YourPage.aspx.cs"


Posted: 12/2/2011

mk781
m k
Lurker 20  points  Lurker
  • Joined on: 11/25/2011
  • Posts: 4

Hi

First thanks for your reply. I checked my file and it is as you mentioned CodeBehind="YourPage.aspx.cs"  but it still doesn't work (: 

 


Page 1 of 1 (3 items)