Visual Studio 2003 reformats/removes HTML code in Design mode

G

Guest

I have an html table based form that has textboxes embedded in table rows on
it. I wanted to have the textboxes autosize and also have the table rows
autosize. To accomplish this, I added a user-defined function that counts
the number of carriage return/line feeds and sets the textbox's Row property
accordingly. This works to autosize the textbox. Also, I wanted the
containing table row to autosize to show the full textbox. The reason for
this is I'm making the textbox appear as a label (style="OVERFLOW: hidden").
To accomplish, I have the function pass back a string with the number of
pixels represented by the number of rows in the textbox. I assign this
return value to the Height attribute of the row as follows:

<TD vAlign="middle" align="left" colSpan="4" style="HEIGHT:
=GetKeyTermsHeight()" >

This works great! The problem is that the next time I open the form, the
Visual Studio designer opens the form and goes to the Design tab. This
reformats the HTML automatically and removes the style="HEIGHT:
=GetKeyTermsHeight()" code above. No warning! I turned off ALL auto
formatting of HTML/XML in Tools/Options. No help there! What can be done to
prevent this? Currently, I'm saving the <TD> definition to the Code behind
window as a comment and repasting it in the HTML view before rebuilding my
solution. It's a big pain though because the project is very large, and I'm
concerned that another developer will unwillingly change and lose this
feature for me. I'd like to add the autosize to my other forms, but doing so
would be a code management nightmare that I can't afford right now. Any
ideas? Please!
 
C

Cor Ligthert

tpirkle,

I can give you a solutions, however probably that will not work because of
the fact that a aspx page (what is an HTML page) is dependend from the
settings of the user.

That can be such a lot that you cannot manage that from your application.
Think about that from the screen format and all those settings that can be
done in the browser (where you probably have done it now only for the last
IE's)

To set what you want you need the attributes property

http://msdn.microsoft.com/library/d...webcontrolswebcontrolclassattributestopic.asp

I hope this helps,

Cor
 

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

Top