Ask a Question related to ASP.NET General, Design and Development.
-
E #1
__doPostBack code block not being generated by asp.net page
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.
E Guest
-
Template-generated pages block editing
I have a peculiar problem that although I have full administrative permissions set, and I have all permissions set for styles, on any page generated... -
Custom tool warning: DiscoCodeGenerator unable to initialize code generator. No code generated.
I created a brand new WebService (HelloWorld) and when I attempt to add this WebService to a WindowsForm project I get the following error message in... -
How can I comment out a large block of perl code?
$ perldoc -q 'How can I comment out a large block of perl code?' says to use =begin comment text, =end comment text, but I find the =end comment... -
Why wont the code in the else block run ?
Hi just a quick question. I have a block of code to stop a user double clicking button (adapted from a double form submit blocker). Simple... -
code block in template control
I have created a templated control. I used for a while and the I decided to put some internatioanlized string instead of hardcoded string into the... -
E #2
Re: __doPostBack code block not being generated by asp.net page
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:1E2dnWktap18K7WiXTWJhg@speakeasy.net...id="webfrmForm">> 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"expected> <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 ancan't> 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> 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.
>
>
E Guest
-
Ram #3
Re: __doPostBack code block not being generated by asp.net page
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:<9OydndM2IY-JJ7WiXTWJjQ@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:1E2dnWktap18K7WiXTWJhg@speakeasy.net...> id="webfrmForm">> > 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"> expected> > <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> can't> > 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> > 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.
> >
> >Ram Guest
-
John Saunders #4
Re: __doPostBack code block not being generated by asp.net page
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
[email]john.saunders@surfcontrol.com[/email]
"E" <e@noreply.com> wrote in message
news:1E2dnWktap18K7WiXTWJhg@speakeasy.net...id="webfrmForm">> 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"expected> <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 ancan't> 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> 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.
>
>
John Saunders Guest



Reply With Quote

