3

I'm using ajax so I can load the content of the page two on the page one . I'm doing this with javascript code (cannot user UpdatePanel) . The problem is : I need to execute some c# code , and ONLY AFTER that , execute the javascript code to open the page . But when the javascript is executed , the page had postback , which means the page one is gone . So , I REALLY need to stop the postback . Any ideas ?

Thanks in advance .

3 Answers 3

4

can't you use a page method web service and call that to execute your c# code - that will return you to your javascript.

Sign up to request clarification or add additional context in comments.

1 Comment

yah, this is one possibility.
1

not really got what u mean by stopping postback...

u are able to handle postbacks

if (Page.IsPostBack)
        {
            //ur c# code here
            //and after u are done with c# call/exec js
        }

1 Comment

That prevents some code from being executed , but does not avoid the postback . I have a page inside another page . When the postback happens , only the inner page remains .
-1

Maybe you can just add "return false;" to the end of the javascript code?

I'm not sure if it works but as far as I know it avoids postbacks after button clicks for example.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.