lglifesgood
lglifesgood

Reputation: 51

Avoiding Postback on ASP.NET / C#

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 .

Upvotes: 2

Views: 701

Answers (2)

Nika G.
Nika G.

Reputation: 2384

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
        }

Upvotes: 0

iandayman
iandayman

Reputation: 4467

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

Upvotes: 3

Related Questions