468,505 Members | 1,592 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

2.0 SIMPLE PROBLEM: asp:Button click at server

Hi
I have very simple problem - I need to process asp:Button click at
server. I have written (my experience is little) in .aspx:

<asp:Button ID="GoTo" runat="server"
Text="Go To" OnClick="GoTo_Click" />

and in .aspx.cs I have written:
....
protected void Page_Load(object sender, EventArgs e)
{
GoTo.Click += new EventHandler(this.GoTo_Click);
}
public void GoTo_Click(object sender, EventArgs e)
{
Response.Redirect(...);
}
....

I don't understand why it doesn't work - GoTo_Click is not called.
Could you explain me please what's wrong? (I copied MSDN sample code).
Thank you!!!
/RAM/
Apr 12 '06 #1
4 1529
Are you using Visual Studio? Not required, but just wondering...

"R.A.M." <r_********@poczta.onet.pl> wrote in message
news:cf********************************@4ax.com...
Hi
I have very simple problem - I need to process asp:Button click at
server. I have written (my experience is little) in .aspx:

<asp:Button ID="GoTo" runat="server"
Text="Go To" OnClick="GoTo_Click" />

and in .aspx.cs I have written:
...
protected void Page_Load(object sender, EventArgs e)
{
GoTo.Click += new EventHandler(this.GoTo_Click);
}
public void GoTo_Click(object sender, EventArgs e)
{
Response.Redirect(...);
}
...

I don't understand why it doesn't work - GoTo_Click is not called.
Could you explain me please what's wrong? (I copied MSDN sample code).
Thank you!!!
/RAM/

Apr 12 '06 #2
On Wed, 12 Apr 2006 13:35:31 -0700, "Jeff Dillon"
<je********@hotmail.com> wrote:
Are you using Visual Studio? Not required, but just wondering...

Yes, I am.
Apr 13 '06 #3
Load your page into the designer, then double click on the button to create
the click event handler

Jeff

"R.A.M." <r_********@poczta.onet.pl> wrote in message
news:8u********************************@4ax.com...
On Wed, 12 Apr 2006 13:35:31 -0700, "Jeff Dillon"
<je********@hotmail.com> wrote:
Are you using Visual Studio? Not required, but just wondering...

Yes, I am.

Apr 13 '06 #4
On Thu, 13 Apr 2006 09:49:24 -0700, "Jeff Dillon"
<je********@hotmail.com> wrote:
Load your page into the designer, then double click on the button to create
the click event handler


I tried. Visual Studio did the same thing as I had done manually.
It didn't help.
Apr 18 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by pkp303 | last post: by
4 posts views Thread by Rodrigo Ferreira | last post: by
2 posts views Thread by Lasse Edsvik | last post: by
1 post views Thread by RUIZCJ | last post: by
2 posts views Thread by DFDavis | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.