Setting HTMLTableRow Visible Property

Posted on 2009-04-15
Last Modified: 2012-05-06
I am having a problem setting the Visible property of my HTMLTableRow. No matter what I do, it is always false. The following returns true...but it won't stay true setting to the visible property.


I am using ASP.NET and C#. I have Visual Studio 2005.
<TR id="trIsBudgeted" runat="server"> 

	<TD>Cost (U.S. $)</TD>


	<TABLE id="Table13" cellSpacing="0" cellPadding="0" border="0">


		<TD width="70"><asp:textbox id="cost" runat="server" Width="65px"></asp:textbox></TD>

		<TD><asp:checkbox id="isBudgeted" runat="server" Text="This step has been factored in the applicable budget."></asp:checkbox></TD>





In my code behind:

trIsBudgeted.Visible = Convert.ToBoolean(PortalMngr.AppValue("RMISMitStepUsesBudgeted"));

Open in new window

Question by:lmred
  • 2

Expert Comment

ID: 24149985
I believe you'll need to set the style such as:

trIsBudgeted.Attributes.Add("style", "visibility:hidden");

Author Comment

ID: 24150252

That did not work.

Accepted Solution

ViceroyFizzlebottom earned 100 total points
ID: 24152245
I would look at the conversion you're doing. I made a mock-up version of what you're attempting there, and when I toggle the visibility, everything works just fine for me. The only variable in this whole thing is the conversion you are trying. Just for testing purposes, have you attempted for force a 'true' or 'false'?

Note: Refer to my test code below. Both methods are actually working for me, i.e., setting the visibility explicitly (as opposed to letting the Convert method set it) and applying a style attribute.

<html xmlns="" >

<head runat="server">




    <form id="form1" runat="server">





                <TR id="trIsBudgeted" runat="server"> 

                    <TD>Cost (U.S. $)</TD>


                        <TABLE id="Table13" cellSpacing="0" cellPadding="0" border="0">


                                <TD width="70">

                                    <asp:textbox id="cost" runat="server" Width="65px"></asp:textbox>



                                    <asp:checkbox id="isBudgeted" runat="server" Text="This step has been factored in the applicable budget."></asp:checkbox>











        <asp:Button runat="server" ID="btnHideRow" Text="Hide Row" OnClick="Click_Me"/>





/**************** Code Behind **************************/

protected void Click_Me(object sender, EventArgs e)


            // This is working for me

            trIsBudgeted.Visible = !(trIsBudgeted.Visible);

            // This also works for me

            //trIsBudgeted.Attributes.Add("style", "visibility:hidden"); 


Open in new window


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now