Вопрос

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

Это было полезно?

Решение

Your code should look like this :

<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>

and then, in your bigimage.aspx file, you'd have some HTML (the CSS and javascript you may need) + an image tag :

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

I presume the querystring params indicate which image you want and the needed size

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top