473,320 Members | 1,914 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,320 software developers and data experts.

__doPostBack code block not being generated by asp.net page

E
I have 2 aspx pages... neither of which do anything out of the ordinary.

One of the pages automatically generates this block of code when viewed at
the client:
------------------------------------------------------------
<form name="webfrmForm" method="post" action="pokedex.aspx" id="webfrmForm">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="[extensive data]" />

<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document.forms["webfrmForm"];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
------------------------------------------------------------

The other asp page generates only this:

------------------------------------------------------------
<form name="wfrmPokedat" method="post" action="pokedat.aspx"
id="wfrmPokedat">
<input type="hidden" name="__VIEWSTATE" value="[data]" />
------------------------------------------------------------

The net result is that the first page can have objects onclick perform a
__doPostBack, and the other page throws a javascript error about an expected
object; and rightfully so, the __dopostback routine isn't there. But why
isn't it?

What triggers the asp.net creation of the __doPostBack code block? It's
also missing it's __EVENTTARGET and __EVENTARGUMENT hidden values. I can't
find any significant differences in either of my pages that would cause
this. I'm using framework 1.1 and 2003 rc2/iis6 server & notepad as an
editor.
Nov 17 '05 #1
3 10855
E
I discovered that the difference between the pages was a combo box on the
first page had the autopostback property of true, whereas the other page did
not have this poperty specified at all. Setting this property to true on
the second page caused asp.net to auto-generate the postback block I was
looking for.

How else can I get asp.net to generate this block? I don't want my combo
box on the second page to autopostback...
"E" <e@noreply.com> wrote in message
news:1E********************@speakeasy.net...
I have 2 aspx pages... neither of which do anything out of the ordinary.

One of the pages automatically generates this block of code when viewed at
the client:
------------------------------------------------------------
<form name="webfrmForm" method="post" action="pokedex.aspx" id="webfrmForm"> <input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="[extensive data]" />

<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document.forms["webfrmForm"];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
------------------------------------------------------------

The other asp page generates only this:

------------------------------------------------------------
<form name="wfrmPokedat" method="post" action="pokedat.aspx"
id="wfrmPokedat">
<input type="hidden" name="__VIEWSTATE" value="[data]" />
------------------------------------------------------------

The net result is that the first page can have objects onclick perform a
__doPostBack, and the other page throws a javascript error about an expected object; and rightfully so, the __dopostback routine isn't there. But why
isn't it?

What triggers the asp.net creation of the __doPostBack code block? It's
also missing it's __EVENTTARGET and __EVENTARGUMENT hidden values. I can't find any significant differences in either of my pages that would cause
this. I'm using framework 1.1 and 2003 rc2/iis6 server & notepad as an
editor.

Nov 17 '05 #2
Ram
You need to have atleast one web server control that has a
autopostback property to true. Otherwise that code block will not be
generated. Insert a server button on the page and the code block will
be generated.

Thanks
Ram

"E" <e@noreply.com> wrote in message news:<9O********************@speakeasy.net>...
I discovered that the difference between the pages was a combo box on the
first page had the autopostback property of true, whereas the other page did
not have this poperty specified at all. Setting this property to true on
the second page caused asp.net to auto-generate the postback block I was
looking for.

How else can I get asp.net to generate this block? I don't want my combo
box on the second page to autopostback...
"E" <e@noreply.com> wrote in message
news:1E********************@speakeasy.net...
I have 2 aspx pages... neither of which do anything out of the ordinary.

One of the pages automatically generates this block of code when viewed at
the client:
------------------------------------------------------------
<form name="webfrmForm" method="post" action="pokedex.aspx"

id="webfrmForm">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="[extensive data]" />

<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document.forms["webfrmForm"];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
------------------------------------------------------------

The other asp page generates only this:

------------------------------------------------------------
<form name="wfrmPokedat" method="post" action="pokedat.aspx"
id="wfrmPokedat">
<input type="hidden" name="__VIEWSTATE" value="[data]" />
------------------------------------------------------------

The net result is that the first page can have objects onclick perform a
__doPostBack, and the other page throws a javascript error about an

expected
object; and rightfully so, the __dopostback routine isn't there. But why
isn't it?

What triggers the asp.net creation of the __doPostBack code block? It's
also missing it's __EVENTTARGET and __EVENTARGUMENT hidden values. I

can't
find any significant differences in either of my pages that would cause
this. I'm using framework 1.1 and 2003 rc2/iis6 server & notepad as an
editor.

Nov 17 '05 #3
Take a look at Page.GetPostBackEventReference. It looks like it might have
to generate the script in order to get you a reference to it.
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

"E" <e@noreply.com> wrote in message
news:1E********************@speakeasy.net...
I have 2 aspx pages... neither of which do anything out of the ordinary.

One of the pages automatically generates this block of code when viewed at
the client:
------------------------------------------------------------
<form name="webfrmForm" method="post" action="pokedex.aspx" id="webfrmForm"> <input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="[extensive data]" />

<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform = document.forms["webfrmForm"];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>
------------------------------------------------------------

The other asp page generates only this:

------------------------------------------------------------
<form name="wfrmPokedat" method="post" action="pokedat.aspx"
id="wfrmPokedat">
<input type="hidden" name="__VIEWSTATE" value="[data]" />
------------------------------------------------------------

The net result is that the first page can have objects onclick perform a
__doPostBack, and the other page throws a javascript error about an expected object; and rightfully so, the __dopostback routine isn't there. But why
isn't it?

What triggers the asp.net creation of the __doPostBack code block? It's
also missing it's __EVENTTARGET and __EVENTARGUMENT hidden values. I can't find any significant differences in either of my pages that would cause
this. I'm using framework 1.1 and 2003 rc2/iis6 server & notepad as an
editor.

Nov 17 '05 #4

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

Similar topics

14
by: Akbar | last post by:
Hey there, Big-time curiosity issue here... Here's the test code (it's not that long)... it's to display a large number of image links with captions, ideally pulled in from an external file...
1
by: Randy | last post by:
Does anyone know of a situation where the "__doPostBack" function would not be auto-generated for your ASPX page? (ie. when the ASPX page is rendered in IE and you do a View Source, the...
1
by: paul reed | last post by:
Hello, I am having some weird behavior between two machines...one which is running the 1.1 framework and one which is running 1.0. After opening a child form from a parent...I update the...
1
by: Adrian | last post by:
I appear to be losing ViewState information when calling the __doPostBack function. I am attempting to use the showModalDialog to load a new web page which confirms that a user wishes to save a...
0
by: Granger Godbold | last post by:
This is in regards to the long-standing bug with the colons in the form-id. I'm not satisfied with the main workaround that's been circulating: http://www.asp.net/Forums/ShowPost.aspx?PostID=191953...
3
by: Steve Wonderful | last post by:
I checked the rendered html and found __doPostBack() function was not found in the html source. Is there a reason? How do I force it to be generated. The page seems to function properly for post...
1
by: Philip | last post by:
I am attempting to use the ASP.NET generated __doPostBack JavaScript function in my custom JavaScript and I can use it successfully but only after the web page is loaded and idle. I prefer to...
0
by: AncaT | last post by:
Hi, I have just started working w/ asp.net, vb.net. I have a .aspx page that contains user defined controls. Inside these controls, I have a 'Delete' hyperlink. This is the code: Inside...
0
by: =?Utf-8?B?Uml0YUc=?= | last post by:
Hello. I'm maintaining a C# Web based project that has a class which adds a "Show All" / "Show By Page" functionality to a datagrid that allows paginating. This class works when there are...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.