post back not working

T

tshad

I have just installed IIS and ASP.NET running on my XP professional machine.

I am just checking to see if the setup is working and the page sort of
works, but not on the submit (post back).

When the page first displays it displays the push button correctly and
everything else is blank. Here is my code:

***************************************************
<script runat="server">
Sub Page_Load
if Page.IsPostBack then
lbl1.Text="The date and time is " & now()
end if
End Sub

Sub submit(s As Object, e As EventArgs)
lbl2.Text="Hello World!"
End Sub
</script>

<html>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
<h3><asp:label id="lbl2" runat="server" /></h3>
<asp:button text="Submit" onclick="submit" runat="server" />
</form>
</body>
</html>
*********************************************************

If I change the "if Page.IsPostBack then" to "if not Page.IsPostBack then"
the page correctly displays the date and time.

But if I run it as is, there is a blank page with a submit button. If I
press the button I get the same page back - no date and time - and the lbl2
label does not display the "Hello World!".

Is it the code or is there something wrong with how I set up the XP, IIS
and/or .NET.

Thanks,

Tom.
 
T

tshad

tshad said:
I have just installed IIS and ASP.NET running on my XP professional
machine.

I am just checking to see if the setup is working and the page sort of
works, but not on the submit (post back).

When the page first displays it displays the push button correctly and
everything else is blank. Here is my code:

***************************************************
<script runat="server">
Sub Page_Load
if Page.IsPostBack then
lbl1.Text="The date and time is " & now()
end if
End Sub

Sub submit(s As Object, e As EventArgs)
lbl2.Text="Hello World!"
End Sub
</script>

<html>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
<h3><asp:label id="lbl2" runat="server" /></h3>
<asp:button text="Submit" onclick="submit" runat="server" />
</form>
</body>
</html>
*********************************************************

If I change the "if Page.IsPostBack then" to "if not Page.IsPostBack then"
the page correctly displays the date and time.

But if I run it as is, there is a blank page with a submit button. If I
press the button I get the same page back - no date and time - and the
lbl2 label does not display the "Hello World!".

Is it the code or is there something wrong with how I set up the XP, IIS
and/or .NET.

I just found out that the problem happens only when the form method is set
to "post" or default:

<form runat="server">

which does a post.

It does have the viewstate line:

<input type="hidden" name="__VIEWSTATE"
value="dDwtNDk1NTEyNzQ2Ozs+xTcbg4vKEUP5LptWdVGn/abFC58=" />

But it never goes to the Submit procedure and doesn't do the isPostBack
procedure.

But if I change the form line to :

<form method="get" runat="server">

Then it works.

This apparently has to do with my machine as the original code seems to have
worked on someone else's machine.

What is wrong with my machine?

Obviously, ASP.NET is working as it worked fine when I changed it to "get"

Thanks,

Tom
 
M

Martin Dechev

Hi, Tom,

For what is called auto-event-wire-up (see
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconWebFormsEventModel.asp)
to work your method Page_Load needs to have the following signature:

[VB.NET]
Sub EventHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
[C#]
void Page_Load(System.Object sender, System.EventArgs e)

because the type of this particular event - the event Load (inherited from
System.Web.UI.Control
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassLoadTopic.asp)
of the System.Web.UI.Page class - is System.EventHandler
(http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEventHandlerC
lassTopic.asp), which requires the declaration of your event handler to have
the same parameters.

Hope this helps
Martin
 
T

tshad

Martin Dechev said:
Hi, Tom,

For what is called auto-event-wire-up (see
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconWebFormsEventModel.asp)
to work your method Page_Load needs to have the following signature:

[VB.NET]
Sub EventHandler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
[C#]
void Page_Load(System.Object sender, System.EventArgs e)

because the type of this particular event - the event Load (inherited from
System.Web.UI.Control
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassLoadTopic.asp)
of the System.Web.UI.Page class - is System.EventHandler
(http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEventHandlerC
lassTopic.asp), which requires the declaration of your event handler to
have
the same parameters.

Understand that this was nothing more that just a small program I quickly
put together to make sure that asp.net was working correctly on my system.

This program actually works fine on my W2000 Server. And it also works fine
if I add "method=get" on my XP machine.

Why doesn't "post" work on XP?

I also appreciate the links as I had not read them before and had not heard
of auto-event-wire-up before.

Thanks,

Tom.
 
T

tshad

I tried that, with another program (with and without the AutoEventWireUp)
and it still doesn't work.

The problem has something to do with "post" vs "get". Get works fine and
post never works.

Thanks,

Tom.

Martin Dechev said:
Hi, Tom,

For what is called auto-event-wire-up (see
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconWebFormsEventModel.asp)
to work your method Page_Load needs to have the following signature:

[VB.NET]
Sub EventHandler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
[C#]
void Page_Load(System.Object sender, System.EventArgs e)

because the type of this particular event - the event Load (inherited from
System.Web.UI.Control
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassLoadTopic.asp)
of the System.Web.UI.Page class - is System.EventHandler
(http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEventHandlerC
lassTopic.asp), which requires the declaration of your event handler to
have
the same parameters.

Hope this helps
Martin
tshad said:
I just found out that the problem happens only when the form method is
set
to "post" or default:

<form runat="server">

which does a post.

It does have the viewstate line:

<input type="hidden" name="__VIEWSTATE"
value="dDwtNDk1NTEyNzQ2Ozs+xTcbg4vKEUP5LptWdVGn/abFC58=" />

But it never goes to the Submit procedure and doesn't do the isPostBack
procedure.

But if I change the form line to :

<form method="get" runat="server">

Then it works.

This apparently has to do with my machine as the original code seems to have
worked on someone else's machine.

What is wrong with my machine?

Obviously, ASP.NET is working as it worked fine when I changed it to
"get"

Thanks,

Tom
 
T

tshad

OK.

It seems to be Browser related. IE 6.0 is having the problem (even at low
security).

I just loaded Netscape 7.0 and tried it with that and it works fine.

What could be causing IE not to work with Post?

Thanks,

Tom

tshad said:
I tried that, with another program (with and without the AutoEventWireUp)
and it still doesn't work.

The problem has something to do with "post" vs "get". Get works fine and
post never works.

Thanks,

Tom.

Martin Dechev said:
Hi, Tom,

For what is called auto-event-wire-up (see
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconWebFormsEventModel.asp)
to work your method Page_Load needs to have the following signature:

[VB.NET]
Sub EventHandler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
[C#]
void Page_Load(System.Object sender, System.EventArgs e)

because the type of this particular event - the event Load (inherited
from
System.Web.UI.Control
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassLoadTopic.asp)
of the System.Web.UI.Page class - is System.EventHandler
(http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEventHandlerC
lassTopic.asp), which requires the declaration of your event handler to
have
the same parameters.

Hope this helps
Martin
tshad said:
I have just installed IIS and ASP.NET running on my XP professional
machine.

I am just checking to see if the setup is working and the page sort of
works, but not on the submit (post back).

When the page first displays it displays the push button correctly and
everything else is blank. Here is my code:

***************************************************
<script runat="server">
Sub Page_Load
if Page.IsPostBack then
lbl1.Text="The date and time is " & now()
end if
End Sub

Sub submit(s As Object, e As EventArgs)
lbl2.Text="Hello World!"
End Sub
</script>

<html>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
<h3><asp:label id="lbl2" runat="server" /></h3>
<asp:button text="Submit" onclick="submit" runat="server" />
</form>
</body>
</html>
*********************************************************

If I change the "if Page.IsPostBack then" to "if not Page.IsPostBack then"
the page correctly displays the date and time.

But if I run it as is, there is a blank page with a submit button. If
I
press the button I get the same page back - no date and time - and the
lbl2 label does not display the "Hello World!".

Is it the code or is there something wrong with how I set up the XP,
IIS
and/or .NET.

I just found out that the problem happens only when the form method is
set
to "post" or default:

<form runat="server">

which does a post.

It does have the viewstate line:

<input type="hidden" name="__VIEWSTATE"
value="dDwtNDk1NTEyNzQ2Ozs+xTcbg4vKEUP5LptWdVGn/abFC58=" />

But it never goes to the Submit procedure and doesn't do the isPostBack
procedure.

But if I change the form line to :

<form method="get" runat="server">

Then it works.

This apparently has to do with my machine as the original code seems to have
worked on someone else's machine.

What is wrong with my machine?

Obviously, ASP.NET is working as it worked fine when I changed it to
"get"

Thanks,

Tom

Thanks,

Tom.
 
T

Tom Bx

Hi, I have recently experienced the same problem. We have a large and
complicated web project that we have been developing for some time.
Our development process is to work on copies of the projects on our
local workstations and then push out to a development server when we
are finished.

Basically, on my local workstation (win XP) all buttons on the site
have stopped working, even though they have worked before and no
changes have been made to the code. The buttons still work fine on the
development server (win 2000 server), however! I have to think this is
a glitch in browser security, but I don't have any idea how to fix it.

Help would be appreciated.
OK.

It seems to be Browser related. IE 6.0 is having the problem (even at low
security).

I just loaded Netscape 7.0 and tried it with that and it works fine.

What could be causing IE not to work with Post?

Thanks,

Tom

tshad said:
I tried that, with another program (with and without the AutoEventWireUp)
and it still doesn't work.

The problem has something to do with "post" vs "get". Get works fine and
post never works.

Thanks,

Tom.

Martin Dechev said:
Hi, Tom,

For what is called auto-event-wire-up (see
http://msdn.microsoft.com/library/en-us/vbcon/html/vbconWebFormsEventModel.asp)
to work your method Page_Load needs to have the following signature:

[VB.NET]
Sub EventHandler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
[C#]
void Page_Load(System.Object sender, System.EventArgs e)

because the type of this particular event - the event Load (inherited
from
System.Web.UI.Control
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassLoadTopic.asp)
of the System.Web.UI.Page class - is System.EventHandler
(http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemEventHandlerC
lassTopic.asp), which requires the declaration of your event handler to
have
the same parameters.

Hope this helps
Martin
I have just installed IIS and ASP.NET running on my XP professional
machine.

I am just checking to see if the setup is working and the page sort of
works, but not on the submit (post back).

When the page first displays it displays the push button correctly and
everything else is blank. Here is my code:

***************************************************
<script runat="server">
Sub Page_Load
if Page.IsPostBack then
lbl1.Text="The date and time is " & now()
end if
End Sub

Sub submit(s As Object, e As EventArgs)
lbl2.Text="Hello World!"
End Sub
</script>

<html>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
<h3><asp:label id="lbl2" runat="server" /></h3>
<asp:button text="Submit" onclick="submit" runat="server" />
</form>
</body>
</html>
*********************************************************

If I change the "if Page.IsPostBack then" to "if not Page.IsPostBack
then"
the page correctly displays the date and time.

But if I run it as is, there is a blank page with a submit button. If
I
press the button I get the same page back - no date and time - and the
lbl2 label does not display the "Hello World!".

Is it the code or is there something wrong with how I set up the XP,
IIS
and/or .NET.

I just found out that the problem happens only when the form method is
set
to "post" or default:

<form runat="server">

which does a post.

It does have the viewstate line:

<input type="hidden" name="__VIEWSTATE"
value="dDwtNDk1NTEyNzQ2Ozs+xTcbg4vKEUP5LptWdVGn/abFC58=" />

But it never goes to the Submit procedure and doesn't do the isPostBack
procedure.

But if I change the form line to :

<form method="get" runat="server">

Then it works.

This apparently has to do with my machine as the original code seems to
have
worked on someone else's machine.

What is wrong with my machine?

Obviously, ASP.NET is working as it worked fine when I changed it to
"get"

Thanks,

Tom

Thanks,

Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top