Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm a newbie to asp.net or should say web applications. I'm working on grid view in which I want to show an image on button click event in a new window with a unique URL.

IF you have any idea, I'll share what I had done.

Please share your experience.
Posted

 
Share this answer
 
v2
Comments
Sachin k Rajput 22-Apr-15 6:46am    
Will you please elaborate a little bit.
try this,

VB
<asp:HyperLink id="hyperlink1"
                  ImageUrl="images/pict.jpg"
                  NavigateUrl="http://www.microsoft.com"
                  Text="Microsoft Official Site"
                  Target="_blank"
                  runat="server"/>


or

<asp:ImageButton ... OnClientClick="javascript:window.open('url_to_image');" >



Note:
target="_blank"

javascript:window.open('url_to_image');
 
Share this answer
 
Comments
Sachin k Rajput 22-Apr-15 8:04am    
Thanks for your reply actually I want to show a real image on a unique link on click event of Grid View.

Whenever I'll click the Grid view button then there should be a new link page having image(~/Image/abc.jpeg) on it.

Have you any idea of this?
Hi ,

Try this Html markup. follow below steps

1) add jQuery plun-in in your page
2) Copy below markup and paste it in your html body section
HTML
<div>
	<ul>
		<li>
			<div>
				<a href="#" target="_blank">
					<img src="img/1.jpg" />
				</a>
			</div>
		</li>
		<li>
			<div>
				<a href="#"  target="_blank">
					<img src="img/2.jpg" />
				</a>
			</div>
		</li>
		<li>
			<div>
				<a href="#"  target="_blank">
					<img src="img/3.jpg" />
				</a>
			</div>
		</li>
		<li>
			<div>
				<a href="#"  target="_blank">
					<img src="img/4.jpg" />
				</a>
			</div>
		</li>		
	</ul>
</div>

HTML
<script type="text/javascript">
    $(document).ready(function(){
        $('ul li>div>a').click(function(){
        debugger;
            var path = window.location.protocol + window.location.host;
            window.open(path + $(this).find('>img').attr('src'), '', 'width=640,height=480');
        });
    });
</script>


Regards,
Sarva
 
Share this answer
 
v3
Comments
Sachin k Rajput 23-Apr-15 9:37am    
Hi, I tried the same but it's not working.
Actually I'm loading images from DB and putting these on gridview and a button infront of it on click of which a link will be generated consisting that image.

Have you any idea about this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900