__doPostBack code block not being generated by asp.net page

Discussion in 'ASP .Net' started by E, Jul 31, 2003.

  1. E

    E Guest

    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, Jul 31, 2003
    #1
    1. Advertising

  2. E

    E Guest

    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" <> wrote in message
    news:...
    > 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, Jul 31, 2003
    #2
    1. Advertising

  3. E

    Ram Guest

    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" <> wrote in message news:<>...
    > 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" <> wrote in message
    > news:...
    > > 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.
    > >
    > >
    Ram, Jul 31, 2003
    #3
  4. 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


    "E" <> wrote in message
    news:...
    > 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.
    >
    >
    John Saunders, Jul 31, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cmV6YXM=?=

    __doPostBack not being generated...

    =?Utf-8?B?cmV6YXM=?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    366
    =?Utf-8?B?cmV6YXM=?=
    Feb 10, 2004
  2. =?Utf-8?B?TGFuY2UgQWhsYmVyZw==?=

    ASP.NET 2.0 Page with LinkButton & __doPostBack client side script missing

    =?Utf-8?B?TGFuY2UgQWhsYmVyZw==?=, May 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    987
    =?Utf-8?B?TGFuY2UgQWhsYmVyZw==?=
    May 6, 2004
  3. =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=

    __doPostBack() not generated

    =?Utf-8?B?U3RldmUgV29uZGVyZnVs?=, Mar 14, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    3,788
    George Ter-Saakov
    Mar 16, 2006
  4. morrell
    Replies:
    1
    Views:
    946
    roy axenov
    Oct 10, 2006
  5. TJ
    Replies:
    5
    Views:
    961
    Walter Wang [MSFT]
    Jun 27, 2006
Loading...

Share This Page