Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp:TextBox with TextMode="MultiLine" Wrap="True" will not wrap

UPDATE: The below question is still valid, but I tested my page in Chrome and it works as expected. When I hit the page in IE it does not wrap. I will now start researching this difference. Let me know if you know of the IE fix for this. Thanks

I have an asp:TextBox that will not wrap. I've run across multiple articles that say I must have TextMode="MultiLine" Wrap="True", and I do, but my text still runs out of the text box.

I don't think I need to post the full page, but tell me if I do. Here's my asp:TextBox, and the CSS class acting on the <TD>. Please let me know if you see why my text is not wrapping?!

            <td class="auto-style130" >
                <asp:TextBox ID="lbl_pain1_drug" Width="400px" runat="server" Rows="4"
                    TextMode="MultiLine" Wrap="True" ReadOnly="true" BorderStyle="None"
                    BorderWidth="0" Font-Names="Tahoma" Height="55px" 
                    style="overflow:hidden" >
                </asp:TextBox>
            </td>

Here is the class="auto-style130"

.auto-style130 {
            /*sig section of script*/
            border: .1px solid #808080;
            word-wrap: break-word;
            word-break: break-all;
            height: 50px;
            width: 402px;
            vertical-align: middle;
        }
like image 342
glitzsfa Avatar asked Mar 07 '16 04:03

glitzsfa


1 Answers

Here is the article where I found the solution, it basically says the newest IE browsers handle textbox wrapping just a little different than they used to. The solution was to add white-space: pre-wrap; my CSS. Here's what new block looked like:

.auto-style130 {
    /*drug section of script*/
    border: .1px solid #808080;
    white-space: pre-wrap;
    height: 35px;
    width: 402px;
    vertical-align: middle;
}

This made everything wrap!

like image 195
glitzsfa Avatar answered Nov 14 '22 11:11

glitzsfa