简体   繁体   中英

Asp.net hide html row (tr) from vb.net/c# code

I have a webpage with html table and few rows in it. I would like from my vb.net code to hide some of these rows, so they won't take any space. Possible?

I'm using asp.net vb code framework 4.0.

Thanks.

如果它们的行具有ID和runat =“ server”,则可以使用以下命令:

row.Style.Add("display", "none");

give ids to your tr rows and also add runat="server" for your trs. Now you can access your trs using the given ids and you can hide them

Setting the visibility property to false will hide the tr but may not solve your spacing problem. Instead set css style as "display:none" for the trs that you want to hide. See this for more details http://www.w3schools.com/css/css_display_visibility.asp

If you want to remove the rows with asp.net spefically, you'll need to do some postback (runat="server"). But maybe you might want to consider doing it client side with JavaScript (whether or not using AJAX communication with the server).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM