0

I am wondering it is possible to place html/javascript/etc in a .ashx file. I tried doing this, and I am getting the error "A namespace cannot directly contain members such as fields or methods"

The reason I want to do this, is because I am trying to implement photoswipe (http://www.photoswipe.com). Photoswipe needs some special CSS, which I think I am losing when I go into the .ashx file. I want to be able to add some HTML to it to point at the CSS file that I think I am losing.

Edit: here is an example of what my markup looks like. When I click on the href, I am brought to a new page with ".ashx?QueryStringParms=blah" in the browser. Here is where I believe I am losing my CSS.

    <div style="text-align:center;" class="gallery-page" data-role="content">
    <ul id="gallery" class="gallery" style="max-height: 75%;">
        <li style="height: 120px; width: 93px; padding-bottom: 2px;"><a href="../Utilities/ImageHandler.ashx?QueryStringParms=blah rel="external"><img src="../Utilities/ImageHandler.ashx?QueryStringParms=blah" /></a></li></ul></div>

Thanks

4

1 回答 1

0

您的代码应如下所示:

<div style="text-align:center;" class="gallery-page" data-role="content">
<ul id="gallery" class="gallery" style="max-height: 75%;">
    <li style="height: 120px; width: 93px; padding-bottom: 2px;"><a href="bigimage.aspx?QueryStringParms=blah rel="external"><img src="../Utilities/ImageHandler.ashx?QueryStringParms=blah" /></a></li></ul></div>

然后,在您的 bigimage.aspx 文件中,您将拥有一些 HTML(您可能需要的 CSS 和 javascript)+ 一个图像标签:

<img src="../Utilities/ImageHandler.ashx?QueryStringParms=blah" />

我认为查询字符串参数指示您想要的图像和所需的大小

于 2013-05-14T16:55:59.323 回答