Update page without postback

M

MA

Hi all!

I´ve heard about someone that used webservice to get around postback
everytime a button or something is pushed.

Someone who have tried this out? Or maybe know anything else about this.

/Marre
 
S

Scott M.

If you want a server control to not cause a postback, you can set its
AutoPostBack property value to false.
 
E

Eric

I know about a new features in ASP.NET 2.0 called CallBackManager.
With some client side scripts, you call a function on the server (without a
postback of the page).

I think you can do the same thing today with the XML component XmlHTTP.
Negative: You use a ActiveX Control -> IE


function submitInfo(){
var httpOb = new ActiveXObject("Microsoft.XMLHTTP");

httpOb.Open("POST","http://localhost/postCust.asp", false);
var customer = template.XMLDocument.documentElement;

customer.childNodes.item(0).text = custName.value;
customer.childNodes.item(1).text = custRelation.value;
customer.childNodes.item(2).text = custClass.value;

httpOb.send(template.XMLDocument);
}
 
S

Sky Sigal

Hold on -- just jumping in for a second -- If I am seeing what I think I am
seeing (doing CallBackManager with ASP.NET 1.1 rather than waiting for
2.0) -- has anybody tried doing something:


(Wildly! bad proxy code -- but hopefully readable in terms of intent)

function submitInfo(){
var httpOb = new ActiveXObject("Microsoft.XMLHTTP");

httpOb.Open("POST","http://localhost/postCust.asp", false);
tPostVars = "";
foreach (element in document.form1){
tPostVars += element.name + element.value = "&";
}
httpOb.send(tPostVars);
...send...
...wait...
...regex from the response the __ViewState= value,
...set document.form1.__ViewState to it
...update the interface for whatever regex part you wanted...
...and this would keep the page synched in terms of viewstate (as long
as no objects changed location, etc)?
}
 
M

MA

Hi again!

Thanx for your answers. The clientCallback is the absolute right thing for
me at the moment. Thats exactly what I was looking for!

Thanx!!!!

/Marre
 
J

Justin Beckwith

*laughs* this is great - the you wrote that loops through the Form
elements making a string of values, I just wrote the same thing 5
minutes ago attempting to accomplish the same task. However, I got
drawn to this thread when the server couldnt intrepret the viewstate I
passed back to it. Has anyone else tried this?
 
J

Justin Beckwith

after further review, my viewstate had a (+) sign in it, which was
being converted to a space over HTTP Post. I did a regex javascript
replace for the (+) to (%2B) and there it was.... I managed to post
all of my current form data back to my form via XMLHTTP, and get the
appropriate response on the client - without a postback. How cool is
this? A little innerHTML here, a little regex there, and I'll never
have to post back again.
 

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,995
Messages
2,570,236
Members
46,823
Latest member
Nadia88

Latest Threads

Top