Expand/Collapse table row from hyperlink click

M

moondaddy

Using asp.net 2.0 and c#, I have a table in a webform. One of the rows in
the table has some text used as a main category heading. I want to be able
to click on this heading and display or hide the row under it (similar to
expanding nodes in a tree). How can I do this all client side? I was
thinking of having the heading text look like a hyperlink so it would be
intuitive for users to click on the link to see the row below.

Thanks.
 
M

Mark Rae

Using asp.net 2.0 and c#, I have a table in a webform. One of the rows in
the table has some text used as a main category heading. I want to be
able to click on this heading and display or hide the row under it
(similar to expanding nodes in a tree). How can I do this all client
side? I was thinking of having the heading text look like a hyperlink so
it would be intuitive for users to click on the link to see the row below.

Do you mean something like this: http://www.markrae.com/zzScratch/debug.aspx

If so, just do a View Source and rip the JavaScript function...

Although it ues buttons to toggle the visibility of entire tables, it would
a very simple matter to modify it so that it uses hyperlinks to toggle the
visibility of individual rows...
 
S

Steven Cheng[MSFT]

Thanks for Mark's input.

Hi Moondaddy,

Normally, such show/hide functionality is implemented by client-side
javascript, and you can use the html element's "display" css property to
control whether it is show or hidden. Here are some additional web
articles introducing how to implement such functionality:

http://www.weberdev.com/get_example-4186.html

http://www.aspcode.net/articles/l_en-US/t_default/ASP.NET/ASP.NET-2.0/Contro
ls/Javascript---hide_show-multiple-table-rows_article_349.aspx

If you have any more specific requirement here, please feel free to post
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top