开发者

URL rewriting, postback doesn't work for controls in master page

Bog standard postback stuff going on a la this link: http://ruslany.net/2008/10/aspnet-postbacks-and-url-rewriting/

Adding form1.Action = Request.RawUrl; fixes it as you'd expect, but there is one bug...

I have an ashx which serves a page depending on the parameters. This page, and in fact, all pages, have a Page.master masterpage. On this page is a button, and it is hooked into an onclick event in the codebehind. Clicking this button however does nothing, because the form action code above is breaking it. If I comment it out the button click works fine, but none of my navigation does.

mysite.com/cats/123 is picked up by my a开发者_JAVA技巧shx using rewrite just like the example up top.

When the button is clicked, the form1.Action = Request.RawUrl; which is in the master page load event fires, and sets the action to mysite.com/cats/123 as you'd expect.

At this point the page is served, but the onclick method (which is in the master page) does not fire. Any idea why?

Edit: Maybe my ashx has to do something to preserve the postback data?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜