how to disable asp.net page auto post back?

G

Guest

Does anyone how how can we disable the auto-postback feature in asp.net page?
I have to use a server side control in the page, but the auto post back
feature in it causes problems for me. Please help!

Thanks much,
Junlia
 
L

Lucas Tam

Does anyone how how can we disable the auto-postback feature in
asp.net page? I have to use a server side control in the page, but the
auto post back feature in it causes problems for me. Please help!

You disable autopostback in the control itself... like a dropdown box or
such.
 
G

Guest

But my problems stems from the autopostback feature of asp.net page. I can
disable the autopostback feature on a control, but that does no good to my
problem.
 
L

Lucas Tam

But my problems stems from the autopostback feature of asp.net page. I
can disable the autopostback feature on a control, but that does no
good to my problem.


ASP.NET do not have autopostback - autopostbacks are caused by a specific
control on the page.

Perhaps you did not disable autopostback on all the controls?
 
G

Guest

Since I have to use a server side control, I have to use a form. The form
autopostback to itself as defualt.

And yes, I did set EnableViewState="False" for the control, which should
disable the autopostback feature for the control.

So more precisely, I need to disable the form's autopostback feature.

Thanks,
Junlia
 
B

Brock Allen

Can you explain what your problems actually are? This will help in coming
up with a solution for you.
 
L

Lucas Tam

Since I have to use a server side control, I have to use a form. The
form autopostback to itself as defualt.

And yes, I did set EnableViewState="False" for the control, which
should disable the autopostback feature for the control.

So more precisely, I need to disable the form's autopostback feature.

It's a control on your form that is doing the postback, not the form
itself.

Maybe could you post the HTML output of the form?
 
G

Guest

I'm also facing this problem.

I have a form which has some text boxes and drop downs. I want to disable
the view state of all the controls on the form. When a user clicks an image
button, all I want is grab the values of all the controls and pass them to a
new window through query string ( I do not want to post the form and I use
window.open in javascript). But for some reasons the form does post itself to
the server. How can I disable this form from being posting itself to the
server.

Thanks for your response in advance.
 
B

Brock Allen

If you want some javascript to open a new window for a new URL then you'll
have to write that all yourself. To get the javascript to execute you can
simply call on your ImageButton.Attributes.Add("onclick", "YourJSFunction();
return false;"). The return false will prevent the normal postback.
 
G

Guest

Hi,
Thanks for your response.

An image is used as button, so its not ImageButton, just and HTML <IMG> TAG.
I tried to return false , but still the form posts itself.
<IMG SRC="image/imagefile.jpg" onclick="return openthis('sometext');">
....
<SCRIPT language=javascript>
function openthis(sometextvar)
{
window.open (someurl,'','');
return false;
}
</SCRIPT>

and it didn't work. The form still posts itself.
 

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

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,688
Members
48,796
Latest member
Greg L.

Latest Threads

Top