Help please, this has driven me nuts:
I am developing the default.aspx page. In this page, we allow a user to type
user name/password, and then click on Submit button to login.
<form name="form1" onsubmit="return isValidInput()" action="default.aspx"
method="post">
....
<INPUT type="submit" value="Submit" id="submit">
</form
In Page_Load(), we have a statement to check if this is a postback:
If (this.IsPostBack)
//verifying login info and direct to proper page
else
//display default page
However, for some reason, this.IsPostBack was always false, no matter it was
the first time to view default.aspx from IE or after a user typed a valid
user name/pswd and clicked on Submit button.
Any ideas?
Thanks a lot.> Hello, friends,
> Help please, this has driven me nuts:
> I am developing the default.aspx page. In this page, we allow a user
> to type user name/password, and then click on Submit button to login.
> <form name="form1" onsubmit="return isValidInput()"
> action="default.aspx"
> method="post">
> ...
> <INPUT type="submit" value="Submit" id="submit">
> </form>
> In Page_Load(), we have a statement to check if this is a postback:
> If (this.IsPostBack)
> //verifying login info and direct to proper page
> else
> //display default page
> However, for some reason, this.IsPostBack was always false, no matter
> it was the first time to view default.aspx from IE or after a user
> typed a valid user name/pswd and clicked on Submit button.
> Any ideas?
> Thanks a lot.
I'm not 100% but have you tried using the Server Button control instead?
Kev
You need to drag the <asp:button> onto your form.
NOT the html control "submit button"
...
What you don't see is that with the <asp:button>... ASP.NET is wiring up a
bunch of events for you.
DRAG and DROP the button, don't try to create it by handtyping.
"Andrew" <Andrew@.discussions.microsoft.com> wrote in message
news:9FFCDA5F-78AA-4019-BF29-5D7A49D72929@.microsoft.com...
> Hello, friends,
> Help please, this has driven me nuts:
> I am developing the default.aspx page. In this page, we allow a user to
type
> user name/password, and then click on Submit button to login.
> <form name="form1" onsubmit="return isValidInput()" action="default.aspx"
> method="post">
> ...
> <INPUT type="submit" value="Submit" id="submit">
> </form>
> In Page_Load(), we have a statement to check if this is a postback:
> If (this.IsPostBack)
> //verifying login info and direct to proper page
> else
> //display default page
> However, for some reason, this.IsPostBack was always false, no matter it
was
> the first time to view default.aspx from IE or after a user typed a valid
> user name/pswd and clicked on Submit button.
> Any ideas?
> Thanks a lot.
Instead of :
<form name="form1" onsubmit="return isValidInput()" action="default.aspx"
method="post"
Try :
<form id="form1" onsubmit="return isValidInput()" runat="server" action="default.aspx"
method="post"
( You are missing the "runat" attribute...)
Juan T. Llibre
ASP.NET MVP
ASPNETFAQ.COM : http://www.aspnetfaq.com
==================================
"Andrew" <Andrew@.discussions.microsoft.com> wrote in message
news:9FFCDA5F-78AA-4019-BF29-5D7A49D72929@.microsoft.com...
> Hello, friends,
> Help please, this has driven me nuts:
> I am developing the default.aspx page. In this page, we allow a user to type
> user name/password, and then click on Submit button to login.
> <form name="form1" onsubmit="return isValidInput()" action="default.aspx"
> method="post">
> ...
> <INPUT type="submit" value="Submit" id="submit">
> </form>
> In Page_Load(), we have a statement to check if this is a postback:
> If (this.IsPostBack)
> //verifying login info and direct to proper page
> else
> //display default page
> However, for some reason, this.IsPostBack was always false, no matter it was
> the first time to view default.aspx from IE or after a user typed a valid
> user name/pswd and clicked on Submit button.
> Any ideas?
> Thanks a lot.
That would be advisable, too, but the main problem is
that his form didn't have the runat="server" attribute.
Juan T. Llibre
ASP.NET MVP
ASPNETFAQ.COM : http://www.aspnetfaq.com
==================================
"sloan" <sloan@.ipass.net> wrote in message news:%23El8wuNKGHA.3120@.TK2MSFTNGP10.phx.gbl...
> You need to drag the <asp:button> onto your form.
> NOT the html control "submit button"
> ..
> What you don't see is that with the <asp:button>... ASP.NET is wiring up a
> bunch of events for you.
> DRAG and DROP the button, don't try to create it by handtyping.
>
>
> "Andrew" <Andrew@.discussions.microsoft.com> wrote in message
> news:9FFCDA5F-78AA-4019-BF29-5D7A49D72929@.microsoft.com...
>> Hello, friends,
>>
>> Help please, this has driven me nuts:
>>
>> I am developing the default.aspx page. In this page, we allow a user to
> type
>> user name/password, and then click on Submit button to login.
>>
>> <form name="form1" onsubmit="return isValidInput()" action="default.aspx"
>> method="post">
>> ...
>> <INPUT type="submit" value="Submit" id="submit">
>> </form>
>>
>> In Page_Load(), we have a statement to check if this is a postback:
>>
>> If (this.IsPostBack)
>> //verifying login info and direct to proper page
>> else
>> //display default page
>>
>> However, for some reason, this.IsPostBack was always false, no matter it
> was
>> the first time to view default.aspx from IE or after a user typed a valid
>> user name/pswd and clicked on Submit button.
>>
>> Any ideas?
>>
>> Thanks a lot.
>>
you are absolutely right. thank you.
"Juan T. Llibre" wrote:
> Instead of :
> <form name="form1" onsubmit="return isValidInput()" action="default.aspx"
> method="post">
> Try :
> <form id="form1" onsubmit="return isValidInput()" runat="server" action="default.aspx"
> method="post">
> ( You are missing the "runat" attribute...)
>
> Juan T. Llibre
> ASP.NET MVP
> ASPNETFAQ.COM : http://www.aspnetfaq.com
> ==================================
> "Andrew" <Andrew@.discussions.microsoft.com> wrote in message
> news:9FFCDA5F-78AA-4019-BF29-5D7A49D72929@.microsoft.com...
> > Hello, friends,
> > Help please, this has driven me nuts:
> > I am developing the default.aspx page. In this page, we allow a user to type
> > user name/password, and then click on Submit button to login.
> > <form name="form1" onsubmit="return isValidInput()" action="default.aspx"
> > method="post">
> > ...
> > <INPUT type="submit" value="Submit" id="submit">
> > </form>
> > In Page_Load(), we have a statement to check if this is a postback:
> > If (this.IsPostBack)
> > //verifying login info and direct to proper page
> > else
> > //display default page
> > However, for some reason, this.IsPostBack was always false, no matter it was
> > the first time to view default.aspx from IE or after a user typed a valid
> > user name/pswd and clicked on Submit button.
> > Any ideas?
> > Thanks a lot.
>
0 comments:
Post a Comment