By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,463 Members | 771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,463 IT Pros & Developers. It's quick & easy.

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

P: n/a
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...
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"David" <sp************@spammersgohome.com> wrote in message
news:4c***************@twister.socal.rr.com...
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...

Nov 18 '05 #2

P: n/a
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

"David" <sp************@spammersgohome.com> wrote in message
news:4c***************@twister.socal.rr.com...
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...

Nov 18 '05 #3

P: n/a
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.
"David" <sp************@spammersgohome.com> wrote in message
news:4c***************@twister.socal.rr.com...
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...

Nov 18 '05 #4

P: n/a
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[i].style.display = sDisplay;
}
}
}

More info:
http://msdn.microsoft.com/library/de...ence_entry.asp

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
"David" <sp************@spammersgohome.com> wrote in message
news:4c***************@twister.socal.rr.com...
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...

Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.