Thursday, March 29, 2012

onsubmit question - can't figure out

This has got to be easy, but I can't figure it out.
I have a login control with a login button to process the username,password,
etc.
I have the login control within a login page, and this page has the form
tags in it......
//this doesn't work for the onsubmit
<form id="Form1" method="post" runat="server" onsubmit="Button1_Click">
<uc1:Top id="Top1" runat="server"></uc1:Top>
<uc1:SideNav id="SideNav1" runat="server"></uc1:SideNav>
<uc1:Login id="Login1" runat="server"></uc1:Login>
</form>
I'm trying to call the Button1_Click method within Login control when the
form is submitted. It's not reaching it, what am I doing wrong?'onsubmit' is a client side event. You can't call a server side function to
handle a client side event.
You need to write client side script to handle this event on the client,
probably written in javascript.
"Craig" <Craig@.discussions.microsoft.com> wrote in message
news:F611109E-3578-4F55-BCC2-E3A9842F5F78@.microsoft.com...
> This has got to be easy, but I can't figure it out.
> I have a login control with a login button to process the
> username,password,
> etc.
> I have the login control within a login page, and this page has the form
> tags in it......
> //this doesn't work for the onsubmit
> <form id="Form1" method="post" runat="server" onsubmit="Button1_Click">
> <uc1:Top id="Top1" runat="server"></uc1:Top>
> <uc1:SideNav id="SideNav1" runat="server"></uc1:SideNav>
> <uc1:Login id="Login1" runat="server"></uc1:Login>
> </form>
> I'm trying to call the Button1_Click method within Login control when the
> form is submitted. It's not reaching it, what am I doing wrong?
Craig,
You can access the button's click event from within the control itself. You
don't need to tie it to the form submittal at all.
If you're using Visual Studio.Net then the easiest way to access the button
click's event is to go to the design view of the control and double click
the button. That will create the button click event server side within the
control's code behind page.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Craig" <Craig@.discussions.microsoft.com> wrote in message
news:F611109E-3578-4F55-BCC2-E3A9842F5F78@.microsoft.com...
> This has got to be easy, but I can't figure it out.
> I have a login control with a login button to process the
> username,password,
> etc.
> I have the login control within a login page, and this page has the form
> tags in it......
> //this doesn't work for the onsubmit
> <form id="Form1" method="post" runat="server" onsubmit="Button1_Click">
> <uc1:Top id="Top1" runat="server"></uc1:Top>
> <uc1:SideNav id="SideNav1" runat="server"></uc1:SideNav>
> <uc1:Login id="Login1" runat="server"></uc1:Login>
> </form>
> I'm trying to call the Button1_Click method within Login control when the
> form is submitted. It's not reaching it, what am I doing wrong?

0 comments:

Post a Comment