__dopostback issue?

J

James Radke

Hello,

I was doing some testing on an application we are building, and noticed that
if you do not have an item like a textbox, which has it's autopostback set
to true,on a webform page, the javascript code __dopostback will never be
included in the page. Even if you have multiple active buttons on the web
page?

And, if we coded the function ourselves it would not work.

This threw us off, because we were attempting to include client-side
validation/javascript to increase performance (i.e. call webservices and
refresh only items that need to be changed versus refreshing the entire
page), and then manually call the __dopostback at the times that full page
refreshes were required (i.e. that meant that autopostback, was never set to
true).

Can someone tell me why this is? And if there is some setting we can make
to make the __dopostback function even if we don't have any controls with
the autopostback set to true?

Thanks!

Jim
 
T

Teemu Keiski

Hi,

postback script is generated automatically when page has controls that are
not able to post their values to the form post collection without calling
that javascript. You can generate postback call by using one of the follwing
methods:

Page.GetPostBackEventReference
Page.GetPostBackClientHyperLink
Page.GetPostBackClientEvent

First two are used normally (consult docs for further details). They take
reference to a control and optional event argument as parameter and return a
js call to __doPostBack that you can place on the page. Calling these
methods also ensures Page outputs the JavaScript declaration for
__doPostBack script.
 
T

Teemu Keiski

Obvious was missing that:
"postback script is generated automatically when page has controls that are
not able to post their values
"

that these controls do utilize the very same methods and these are controls
that need to participate postback processing.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top