473,408 Members | 1,676 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,408 software developers and data experts.

Show and Hide

Hello,

I created an Asp:Repeater where I have an Asp:Panel and an Asp:Label.
In each record of the repeater I want to have a small button which
hides or shows the panel in that record. If possible with no postback.

And it would be great to have a button like "Show" which would change
to "Hide".
Well, but this is not so important.

Could somebody, please, help me out with this? I have no idea of how to
create this.

Thanks,
Miguel

Oct 19 '06 #1
1 1801
hi

You can use javascript to hide/show the panel inside the repeater.

Create Javascritp function to hide or show panel

function show_hide(pnl, btn)
{
document.getElementById(pnl).style.display =
document.getElementById(pnl).style.display == "none" ? "block" :
"none";

if (document.getElementById(pnl).style.display=="bloc k")
document.getElementById(pnl).caption="Hide";
else
document.getElementById(pnl).caption="Show";
}

now you can call these function on click event of button, to do that
you have bind to fucntion to button control on ItemCreated Event of
Reapeate. following is the code for that.

Private Sub Repeater1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.RepeaterItemEventArgs) Handles
Repeater1.ItemCreated

Dim rtpItem As ListItemType
Dim pnl As HtmlGenericControl
Dim btn As Button
rtpItem = ListItemType.Item
If rtpItem = ListItemType.AlternatingItem Or rtpItem =
ListItemType.Item Then
pnl = CType(e.Item.FindControl("pnl"), HtmlGenericControl)
btn = CType(e.Item.FindControl("btn"), Button)
btn.Attributes.Add("onclick", "show_hide('" & pnl.ClientID
& "','" & btn.ClientID & "');")
End If

End Sub

Note to get the panel control using e.Item.FindControl("pnl") you must
have to make the html panel a server control it means you have to write
runat="server" in html tag of panel control. otherwise you will get
error like control with name pnl not found.

shapper wrote:
Hello,

I created an Asp:Repeater where I have an Asp:Panel and an Asp:Label.
In each record of the repeater I want to have a small button which
hides or shows the panel in that record. If possible with no postback.

And it would be great to have a button like "Show" which would change
to "Hide".
Well, but this is not so important.

Could somebody, please, help me out with this? I have no idea of how to
create this.

Thanks,
Miguel
Oct 19 '06 #2

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

Similar topics

2
by: Ajai Kumar .R | last post by:
Hai all, I've two or more forms on my app. My requirement is, Have to show the first form asa the user press a button have to hide the first form and show the second form. If the user press the...
5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
10
by: oLE | last post by:
I would like to add some javascript to show/hide a certain row of a table. The first row of the table contain the hyperlink that calls the javascript the second row is the one i want to show/hide...
3
by: alex | last post by:
I'd like to have a show/hide widget on my web site, kind of like "show details" / "hide details" in Google Groups. Is there a tutorial explaining how to make them? Google's is a bit complex and...
0
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display...
4
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however...
7
by: FP | last post by:
I'm new to Java Script. I'm displaying comments people have made. Below each persons' comment I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would display an empty text field...
5
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.