473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Image Button and Show/Hide Panel

Hello,

I have an image button in a web page.

The default image is ShowPanel.gif.

When the image is clicked I want the panel "myPanel" to become visible
and the image button to change to HidePanel.gif.

When the image is clicked again now the panel becomes invisible and the
image gets back to ShowPanel.gif.

I have been playing with commandname, commandargument and oncommand
properties but I haven't been able to make this work.

Can someone help me out?

Thanks,
Miguel

Nov 19 '05 #1
4 9866
<img id=img1 name=img1 src=''ShowPanel.gif' onclick ='toggle();' >

this is psudo code. Apply correct syntax

function toggle()
{
if(img1.src=''ShowPanel.gif' )
{
img1.src = 'HidePanel.gif';
myPanel.style.display = '';
}
else
{
img1.src = 'ShowPanel.gif';
myPanel.style.display = 'none';
}
}

Nov 19 '05 #2
Properties can be toggled on and off in the ImageButton click event noting
I'm writing the following on the fly...

// C#
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
if(ImageButton1.ImageUrl == "~/Images/ShowPanel.gif")
{
myPanel.Visible = true;
ImageButton1.ImageUrl = "~/Images/HidePanel.gif";
}
else
{
myPanel.Visible = false;
ImageButton1.ImageUrl = "~/Images/ShowPanel.gif";
}
}

// VB
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As
ImageClickEventArgs)
If ImageButton1.ImageUrl = "~/Images/ShowPanel.gif" Then
myPanel.Visible = True
ImageButton1.ImageUrl = "~/Images/HidePanel.gif"
Else
myPanel.Visible = False
ImageButton1.ImageUrl = "~/Images/ShowPanel.gif"
End If
End Sub

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hello,

I have an image button in a web page.

The default image is ShowPanel.gif.

When the image is clicked I want the panel "myPanel" to become visible and
the image button to change to HidePanel.gif.

When the image is clicked again now the panel becomes invisible and the
image gets back to ShowPanel.gif.

I have been playing with commandname, commandargument and oncommand
properties but I haven't been able to make this work.

Can someone help me out?

Thanks,
Miguel

Nov 19 '05 #3
I wouldnt go to server to toggle an image .. javascript could do it.

Nov 19 '05 #4
Sorry,

I forgot to say something which makes this much more complicated.

All this is inside a Datagrid!

So when I am displaying 10 records I will have 10 buttons and 10 panels
which I need to hide/show when the correspondent button is pressed.

Any idea how to sort this out?

I have seen this in many web sites.

Thanks,
Miguel

"sr**********@gmail.com" <sr**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com:
I wouldnt go to server to toggle an image .. javascript could do it.


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alberto | last post by:
I'm trying to load an image in a PictureBox but I want the PictureBox has always the same size and if the image is bigger, show a scrollBars. How can I do it? Thank you
6
by: Rod Snyder | last post by:
I'm trying to set up a page with an asp.net link button that would send a user to a certain page and on page load execute a specific stored procedure tied to the button on the previous page. The...
5
by: dje | last post by:
In the OnClick event on a radioButtonList, I run a javascript to show/hide the appropriate div along with a submit button, which displays as expected. The problem is the submit no longer works on...
3
by: Mark Szlazak | last post by:
The following page simulates a pool cue and cue ball: http://members.aol.com/myscript/cue.html Mouse cursor position around the cue ball determines where a roll-over of 179 pool cue images is...
10
by: cjparis | last post by:
Hello everyone. If anyone can give me a hand I would be gratefull Am doing a site which requires a moving element and have used DHTML to do it. Have a simple Browser detect script to sort IE...
4
by: glbdev | last post by:
Hi, I posted this question yesterday but didn't get the answer I needed. I am DESPERATE to get this working so I'm re-posting it because I don't think I worded it correctly. I have a GridView...
3
by: chandan | last post by:
Hi, Is any way to palce a control(button/label) at a location on webPage in runtime?? In page_load envet I am adding a button on the page in the contol collection of a panel but not able to...
8
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
I am working with Visual C# window and in my application I need to use a button ( NEXT) . The button should displays one panel with its objects each time it clicked. I already developed the codes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.