Solved

Setting HTMLTableRow Visible Property

Posted on 2009-04-15
3
1,079 Views
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.

Convert.ToBoolean(PortalMngr.AppValue("RMISMitStepUsesBudgeted"))

I am using ASP.NET and C#. I have Visual Studio 2005.
<TR id="trIsBudgeted" runat="server"> 
	<TD>Cost (U.S. $)</TD>
	<TD>
	<TABLE id="Table13" cellSpacing="0" cellPadding="0" border="0">
		<TR>
		<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>
</TR>
	</TABLE>
	</TD>
	</TR>
 
In my code behind:
trIsBudgeted.Visible = Convert.ToBoolean(PortalMngr.AppValue("RMISMitStepUsesBudgeted"));

Open in new window

0
Comment
Question by:lmred
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Expert Comment

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

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

Author Comment

by:lmred
ID: 24150252
ViceroyFizzlebottom,

That did not work.
0
 
LVL 6

Accepted Solution

by:
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="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table>
        <tr>
            <td>
                <TR id="trIsBudgeted" runat="server"> 
                    <TD>Cost (U.S. $)</TD>
                    <TD>
                        <TABLE id="Table13" cellSpacing="0" cellPadding="0" border="0">
                            <TR>
                                <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>
                            </TR>
                        </TABLE>
                    </TD>
                </TR>
            </td>
        </tr>
    </table>
    </div>
    <div>
        <asp:Button runat="server" ID="btnHideRow" Text="Hide Row" OnClick="Click_Me"/>
    </div>
    </form>
</body>
</html>
 
/**************** 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

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
defining NULL or 0 10 50
Unable to connect C# program to an SQL database - Exception occurs. 4 60
Visual Studio hangs on running project 6 61
Website not secure message 4 59
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…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

749 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