"Tim_Mac" <tim.mackey@community.nospamwrote in message
news:OB3Zjia3GHA.5040@TK2MSFTNGP02.phx.gbl...
Quote:
hi,
the problem isn't with VS 2003. the DIV HTML element has no property
called Visible because it doesn't inherit from System.Web.UI.Control. The
Visible property belongs to .Net controls, which DIV is not.
unfortunately just adding on a "runat=server" does not make the control a
.Net control. it just gives you server side access to a HTML element.
Actually, DIV with runat="Server" (which allows the visibility property)
works great. Even DW complains about it not being standard. But I had
found out about this a couple of years ago and have been using it since. It
works great. Not sure why. But obviously it obviously is handled correctly
by the server side.
For example:
Before Div
<div ID="test" Visible="true" runat='server'>This is a test</div>
After Div
will render as:
Before Div
<div id="test">This is a test</div>
After Div
and
Before Div
<div ID="test" Visible="false" runat='server'>This is a test</div>
After Div
renders as:
Before Div
After Div
This allows you to control your text and controls programmatically like
using an asp:Panel. There was something different about the Panel and Div -
but I can't remember what it was.
These links also talk about it.
http://www.thescripts.com/forum/thread532743.html http://msdn.microsoft.com/msdnmag/is...5/CuttingEdge/ http://cfouquet.blogspot.com/ Quote:
>
it sounds like you might make better use of PlaceHolders which leave no
markup on the page, and can be used for Showing/Hiding other controls or
HTML. also the VS designer will probably complain if you put server
controls in invalid places, such as between TABLE and TR tags. it may
refuse to draw the page and throw you into HTML mode.
>
Actually, Div leaves no markup if visible=false. It renders exactly the
same (so not sure why we have Div for this if Panel does the job). Here is
the result if I change the above Div to asp:Panel.
Before Div
<div id="test">
This is a test
</div>
After Div
Exactly the same.
Quote:
also, you can't nest a DIV directly inside a TABLE tag because it is
invalid HTML by any standard.
>
If this is the right, then I don't believe you would be able to use Panel
inside you repeaters and datagrids as they just translate into tables.
I use Div's inside tables all the time.
Quote:
the javascript you're using also appears to be nonstandard. I would
recommend document.getElementById('txtBoxwhatever').
What Javascript? From another post?
Quote:
>
when a Panel is not visible, none of its contents are rendered. This is
the point of setting Visible=False, i.e. the user shouldn't be able to see
it, and by inference the HTML shouldn't be rendered.
>
Same as Div.
I was mistaken about being able to access a textbox when visible=false for
Div. I thought I was able to access it.
Quote:
do you want to use client-side show/hide functionality? it sounds like
your DW background is making life difficult. if you hide a control on the
server, then the rendered HTML is not included for that control. if you
hide it on the client, the HTML never changes and the browser simply makes
the element invisible. i'm sure you know that already but it sounds like
there is some misunderstanding between the effects of server-side and
client-side code.
No. I didn't want client side functionality. I use Div to show/hide areas
of my screen depending on what the client has entered or what I get back
from a database.
My problem is the VS is preventing me from doing what I have been doing for
years and apparently is valid. I was curious if there was a way to get VS
to allow this. I have pages I am trying to move to my VS project that use
this technique and I don't want to have to recode these pages.
Thanks,
Tom
Quote:
>
i hope this answers your question, let me know if anything i've written
isn't clear.
tim.
>
>
"tshad" <tscheiderich@ftsolutions.comwrote in message
news:O1xI4$Z3GHA.3428@TK2MSFTNGP05.phx.gbl...
Quote:
>>I am trying to hide and show certain parts of my code (which I have no
>>problem doing with DW). In VS 2003, it won't let you use <div
>>runat="server"to section of parts of my code in a table. This is during
>>compilation (build).
>>
>My code is:
>>
><TABLE id="Table1" style="WIDTH: 864px; HEIGHT: 177px" cellSpacing="1"
>cellPadding="1"
>width="864" border="0">
><div ID="LogonPanel" Runat="server">
> <TR>
> <TD colSpan="3">
> <asp:label id="Label1" runat="server" Height="24px" Font-Bold="True"
>Font-Size="Larger">Employee Login</asp:label></TD>
> </TR>
>...
></div>
></Table>
>>
>The errors I get are:
>1. Could not find any attribute 'Visible' of element 'div'.
>2. Per the active schema, the element 'div' cannot be nested within
>'table'.
>>
>If I change the <divto <asp:Panel>, I can't access the Textbox.Text?
>>
>It worked fine until I used the Panel. I just put the Panel around the
>Logon section and my code wants to access the Textbox that has the user
>name in it:
>>
>The problem seems to be that when the Panel is not visible anything
>inside is not rendered. This is not the case when using <div
>runat='server'but VS won't let me use that.
>>
>Or is there something I need to do to tell VS to handle it?
>>
>Thanks,
>>
>Tom
>'Document.Forms.0.TextBox1' is null or not an object.
>>
>
>