473,395 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Why it is always: this.IsPostBack = false?

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.

Feb 3 '06 #1
5 11357
> 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
Feb 3 '06 #2

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" <An****@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.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.

Feb 3 '06 #3
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" <An****@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.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.

Feb 3 '06 #4
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" <sl***@ipass.net> wrote in message news:%2****************@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" <An****@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.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.


Feb 3 '06 #5
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" <An****@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.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.


Feb 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: hanct | last post by:
"this" here refer to the form.. I type this.Visible=false;..but the form still can be seen! Worst still, the property editor has no Visible property to play with..why??is that a bug?? Wat the...
0
by: mehul | last post by:
CheckBox template always evaluate to False even if checked in a DataGrid hosted inside a TabStrip in ASP.NET Hi, I am trying to develop an ASP.NET application. I am using TabStrip (which is...
4
by: TJ | last post by:
Hi, There is one aspx web page that contains usercontrol. In aspx page and usercontrol , there is each submit button... Here is what I want... I want to process something depending on each...
3
by: Guy Noir | last post by:
Hello again. I have a form that has 2 buttons. When button 1 is pressed, I want the form to execute a few tasks and give the user feedback. When button 2 is pressed, I want the form to reload as if...
1
by: Kenneth Baltrinic | last post by:
I am having a very odd problem. On a page that was working until very recently we are now encountering the following situation: The page is a very basic fill in the blank form used for changing...
1
by: Kenneth Baltrinic | last post by:
I am having a very odd problem. On a page that was working until very recently we are now encountering the following situation: The page is a very basic fill in the blank form used for changing...
0
by: DC | last post by:
Hi, I am dynamically adding a usercontrol that uses "this.IsPostBack" in Page_Load to decide whether it must populate some of it's inner controls or not. Since I am adding the usercontrol to the...
5
by: dreamer1963 | last post by:
Java looks for the _______________ as the usual starting point for all standalone applications.
10
by: Franco Cassar | last post by:
Ok, so I need to make the PHP form detect whether a string starts with the substring "DonVito:" or not. However, it's always returning a false even when DonVito: is present. <?php...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.