trying to use <div> to hide a bunch of table rows

D

David

I attempted the following

<div id="div" runat="server">
<tr><td></td></tr>
<tr><td></td></tr>
</div>

This is to hide a group of rows depending on some business rules in my code
behind.

It works. BUT.

When I go back to the aspx page, VS.NET has f*d it up by inserting the
</div> tag.

<div id="div" runat="server"></div>
<tr><td></td></tr>
<tr><td></td></tr>
<div></div>

Note to Microsoft. DO NOT EVER DO ME A FAVOR. NEVER ASKED FOR IT, SO
PLEEEEEESE.

Sorry... just had to get it off the chest. Obvously the editor does not
like what it sees and it "corrects" what it does not like. What do you
advise? I have a table with a bunch of rows that encapsulate fields. Under
certain business rules, I would like to hide a group of rows. I suppose I
could do this row by row, but that is a lot of work...
 
A

Ashish M Bhonkiya

Hi David,

I know the visual studio.net does the reformatting of the html tags.. but
there is a good news for you that will no more be there in the Next version
Visual Studio 2005 based on the users feedback this is taken care in
Whidbey.

Right now my suggestion would be to use place holder controls if you are
facing too much problems with the html formatting using DIC or in Visual
Studion you take a look at the settings for

Options->Text Editor->Html-Xml->HTML Specific and see the autor insert
section.

Regards
Ashish M Bhonkiya
 
B

Bob Lehmann

Actually, it is de-f*ing your improper HTML.

If you think the editor doesn't like it, you'll just love what some browsers
will do with it.

Bob Lehmann
 
M

microsoft.public.dotnet.framework.aspnet.webcontro

I have been using ASP Panels for this type of thing, because of the issue
you are running into. Replace your divs with panels, and you can set the
visible property true or false.
 
V

Vidar Petursson

Hi

This is not valid html so don't blame MS ;)

Try giving the <tr> you want to hide/display the same name

<tr name="myStuff"><td></td></tr>
<tr name="myStuff"><td></td></tr>

then to show..

function toggle(){
var e = document.getElementsByName("myStuff");
if(e != null)
{
// Get current status
var sDisplay = ( e.style.display == "none" ) ? "block" : "none";
for(i=0;i<e.length;i++)
{
e.style.display = sDisplay;
}
}
}

More info:
http://msdn.microsoft.com/library/d...hor/dhtml/reference/dhtml_reference_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top