Welcome to MSDN Blogs Sign in | Join | Help
How to expand InputFormTextBox

If you need to expand InputFormTextBox control and CssClass property seems to be not working, continue reading this post.

I’ve created an application page and I used an InputFormTextBox control to give users the possibility to write some html content. This is the code I used:

<wssawc:InputFormTextBox 
Title="My Field"
ID="myField"
Rows="15"
Runat="server"
TextMode="MultiLine"
RichText="true"
RichTextMode="FullHtml"/>

You can see the page rendering in the following picture:

image

As you can see, the control’s width is not at 100% of available space.

Trying to enlarge the control with style and CssClass attributes were unsuccessful. I made some investigations and I discovered that code rendered by the control simply ignores those attributes.

Looking at html generated by the control, I saw that it is rendered as two main element, a table element to display the toolbar and an iframe element for the html container. Both have a css class defined, ms-rtetoolbarmenu for the table (toolbar) and  ms-rtelong for the iframe (html container).

My solution to the problem was to override those classes with the following code

<style type="text/css"> 

table.ms-rtetoolbarmenu{ 
    width:100%;
} 

iframe.ms-rtelong{ 
    width:100%;
} 

</style> 

The page rendering after this modify was:

image

Hope this can help you.

Technorati Tag:
Posted: Thursday, February 19, 2009 6:19 PM by dario.martirani
Filed under:

Comments

Robert Graauw said:

Really really really nice. this is the only thing that works. Thanks for working this out.

WOW!!

# February 26, 2009 8:25 AM

Bill Zimmer said:

I've spent the last several days, on and off, playing with this, trying to find a way to "fix" it. Thanks a million!

# March 2, 2009 4:31 PM

Scot Hillier said:

Nice tip! Thanks.

I put this in the "PlaceHolderAdditionalPageHead" placeholder like this so it works easily with the LAYOUTS pages that are using application.master:

<asp:Content ID="Additional" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

  <style type="text/css">

     table.ms-rtetoolbarmenu{width:100%;}

     iframe.ms-rtelong{width:100%;}

  </style>

</asp:Content>

# March 10, 2009 11:38 AM

Jagadish said:

Thanks a lot... Ur tip really replied me. done

# April 23, 2009 3:12 AM

Reggie said:

This doesn't seem to work for discussion board

# April 30, 2009 9:57 AM

Naryana Reddy said:

Thank you so much .

I have put following code in Page_Load of user control of web part. It is working.

Thank you, Your efforts helped me.

StringBuilder sb = new StringBuilder();

sb.Append("<style type=\"text/css\">table.ms-rtetoolbarmenu{width:100%;}iframe.ms-rtelong{width:100%;}</style>");

Response.Write(sb.ToString());

# July 9, 2009 7:46 AM

piyush patel said:

thank u so much

its work fine

# August 29, 2009 1:42 AM

Arfan said:

Thanks a lot you solved my problem.

# October 21, 2009 9:17 PM

Sylvia said:

Perfect!  I too worked days trying to figure out why this control wouldn't size as I was specifying.  thanks SO Much!

# October 30, 2009 8:17 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker