Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Visual Studio Deletes colspan Attributes From Elements

$
0
0

I've done some research on this issue and have found two sources related to it. Unfortunately, none of them provide satisfying answers. The only one that truly seems to answer the question is on Google Groups, which is why I've decided to ask this on the official Visual Studio form.

I have a table element in my page, within it, I dynamically build TRs with a repeater. I know this can be done with a Datagrid, however, for various reasons, the development was made easier by using a table with a repeater. 

<table class="DetailsView" id="dvPhoneAndEmail"><tbody><tr class="Header"><td colspan="2">Phone Numbers &amp; Email</td></tr><asp:Repeater ID="rptPhoneOrEmail" runat="server"><ItemTemplate><tr class="Row"><td class="FieldHeader"><%# Eval("ContactType")%>:</td><td><telerik:RadTextBox ID="txtPhoneNumber" runat="server" Text='<%# Eval("PhoneNumber") %>'></telerik:RadTextBox><telerik:RadTextBox ID="txtPhoneNumberExtension" runat="server" Label="Extension: " Text='<%# Eval("PhoneExtension") %>'></telerik:RadTextBox></td><td class="ToolsField"><asp:LinkButton ID="lnkRemovePhoneOrEmail" runat="server" CssClass="DeleteLink" CommandArgument='<%# Eval("SequenceNumber") %>' OnClientClick="return confirm('Are you sure you want to delete this information?');">
              Delete</asp:LinkButton></td></tr></ItemTemplate></asp:Repeater><tr class="Row"><td class="FieldHeader"></td><td><asp:LinkButton ID="lnkAddPhoneOrEmail" runat="server" CssClass="AddLink">
          Add New</asp:LinkButton></td></tr></tbody></table>


Currently, this code works, but the table doesn't show properly. As you'll see, my Repeater creates rows with 3 columns, but the wrapping table only has 2 columns. When I try to increase the number of columns to make it look better, Visual Studio automatically removes or "fixes" my colspan tags upon saving. I try to make the top TD have colspan="3" and the bottom TD have colspan="2". However, it changes my top one back to 2 and completely deletes the colspan attribute from the bottom one.

Judging from the posts linked below, this is because Visual Studio is trying to "help" by removing what it sees as unnecessary code. Both posts seem to believe that there is no way to turn this "feature" off in Visual Studio. It seems to me that it's an extremely faulty feature if it actually impedes the flexibility that should come from such a robust IDE. 

I've dealt with this issue before, and my work-arounds have come down to changing the colspan tags and closing the file, only saving when prompted if I want to keep unsaved changes. Visual Studio's "clean-up feature" doesn't seem to take effect there. Another work around is to edit the files in other environments like Notepad++.

These work-arounds, however, are far from ideal. Is this truly a piece of functionality in Visual Studio that is forced on us with no off switch?

http://forums.asp.net/t/1393111.aspx

https://groups.google.com/forum/#!topic/microsoft.public.dotnet.framework.aspnet/TY-L8CY4It4


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>