473,224 Members | 1,549 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,224 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 1794
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.