简体   繁体   中英

Page.IsPostBack always false after urlRewriting

I have a strange problem.

Page.IsPostBack returns always false after url Rewriting.

I am using a link that directs to a function, like,

<a href="#" onclick="return getHelp('4','P')">

This goes to js file and js calls below pagemethod.

<script>
function getHelp(id, type) {
PageMethods.displayHelp(id, type, CallSuccess, CallFailed);
}
</script>

This is the pageMethod that i try to access from javascript,

[System.Web.Services.WebMethod]
public static string displayHelp(string id, string type)
{
 response.writeline(id+type);
}

If i don't use urlrewriting it works perfect. However, if i use urlrewriting, the postback could not recognized.

Any help would be appreciated

It is not apparent to me from your code but if you are simply reloading the page via JavaScript, the postback model will be broken.

Page.ClientScript.GetPostBackEventReference()

to get a client side postback method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM