开发者

asp.net image link in new window with query string parameters

I have a page that I need to provide a link to a print version of that page, the link itself needs a picture and must open in a new window and the print page requires me to pass it a few query string parameters that vary depending on the original pages state.

I have tried a ImageButt开发者_C百科on but there doesn't seem to be a way to make it open in a new window (and still allow me to build up the query string dynamically).

I a hyperlink with an image inside (as the width of a hyperlink doesnt set the image size) but there is no click even server side for me to attach my code for query string generation.

Is there any other solutions?


Try building the URL in the codebehind - something like:

HyperLink1.NavigateURL = myMethodForBuildingUrl();

Where myMethodForBuildingURl() is whatever logic you're using to contruct the query string.


I put the following in the click event of the image button and managed to get everything working

  ClientScriptManager objCsManager = Page.ClientScript;

            objCsManager.RegisterStartupScript(GetType(), "NewWindow", "<script>window.open('" + url + "', 'New')</script>");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜