Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I want to create a JavaScript function in asp.net which returns an image. The image is stored in the solution explorer of visual studio(means it is store in project) and than I can call that function onClientClick of asp.net Button Control.

By default the image visibility should be false on page load of .aspx page. When I click on the asp.net button the image should be visible?

Any help is greatly appreciated.
Posted
Updated 6-Jun-11 0:27am
v3
Comments
senguptaamlan 6-Jun-11 4:18am    
please...provide what you have done....(code/javascript..etc)...can fix it...but can do your task, sry.
Kiran Sonawane 6-Jun-11 4:37am    
Is your images store on hard disk OR database
Ali Al Omairi(Abu AlHassan) 6-Jun-11 7:02am    
wait a minute did you use Image.Visible = false

if so use Image.style.Add("display","none)")

on clientClick use $get('<%Image.ClientID %>').style.display = 'block';
Rohit from Delhi 6-Jun-11 7:41am    
Sir/Mam
Can you please send me code how to create function and call that on button onclientclick
thanks
Ali Al Omairi(Abu AlHassan) 6-Jun-11 10:59am    
actually i am "Sir" don't you see 'Abu AlHassan' in the brackets above.In Arabic Abu means father (the father of AlHassan). a fatther can't be femail,can he?
about your question look below.

Can you please send me code how to create function in javascript in asp.net and call that on button onclientclick in asp.net=
No!

You are no new here and yet you post questions like these. Please avoid it.
Once again, It does not work like this here. There is no quick question here. This sounds like your college project/assignment, you should put some effort.

We expect you to put some time in trying the issue that you are facing and then some time in formulating the question while posting here.

Here is what is expected by enquirers:
1. TRY first what you want to do!
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.
 
Share this answer
 
ASP
<asp:button id="button1" runat="server" onclientclick="javascript:$get('<%img.ClientID %>').style.display = 'block';return false;" Text="view image" />
<asp:image id="img" runat="server" ImageURL="something" style="display:none;" />


i used return false to prevent post-back.
 
Share this answer
 

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