View Full Version : Renaming <Content> to <Body>

Oct 18, 2008, 8:36 AM
The next public build (v0.7) is shaping up to be another monster release. The <ext:TreePanel>, <ext:Menu> and new AjaxEvent features will be included.

But... I come to you now looking for your opinion.

Ever since the first release, the "Content" region of the any Panel type Control (Panel, Window, Tab, etc) has been called <Content>. I was never really 100% happy with the name "Content", but couldn't think of a better label. That is until yesterday when I had a head-slap moment (doah!) and realized it should have been called <Body>.

I'm proposing a change from <Content> to <Body>.</p>

Example (Existing)

<ext:Panel ID="Panel1" runat="server" Title="Title">
        Add Controls Here...

Example (New)

<ext:Panel ID="Panel1" runat="server" Title="Title">
        Add Controls Here...

With existing functionality, on the client/browser, if you want to get an instance of the Panel's "body" element using JavaScript, you call the .getBody() function. The following example demonstrates how to get the body of a Panel during an <ext:Button> <Click> Listener and update the text. </p>


<ext:Button ID="Button1" runat="server" Text="Update Panel Body">
        <Click Handler="Panel1.getBody().update('I just updated the Panel Body!')" />

I was also always bothered by the symantics of adding "Layout" controls to the "Content" area. Adding "Layout" controls to the "Body" makes for a better paradigm and just reads better.

The renaming would create a breaking change if upgrading from v0.6 (or earlier), although the functionality and logic of the <Content>/<Body> would remain unchanged.

I think for most (if not all projects) just a simple search-and-replace would be required to upgrade. The change would affect the following properties.</p>

In Markup
1. <Content> changed to <Body>

In CodeBehind
1. .Content changed to .Body
2. .ContentControls changed to .BodyControls
3. .ContentContainer change to .BodyContainer

I ran a couple tests and was able to update all our Coolite Toolkit projects (including Examples Explorer) took only a couple minutes using the four simple search-and-replace routines as outlined above. Everything recompiled and ran perfectly.

Please let me know what you think.

Oct 18, 2008, 1:48 PM
Hi Geoff,

yes it's true, changing the tag name to Body is the right choice considering the js getBody() function.

... ready for 'search-and-replace' !!


Oct 21, 2008, 8:49 AM
I just can't resist any longer. I'm changing everything over to <Body>.

The new <Body> code will drop into SVN later today and will be included with the v0.7 release.

Please see V0.7 Breaking Changes for more information,*http://forums.ext.net/showthread.php?586

Oct 14, 2009, 11:03 PM
Changing <Content> to <Body> uncovered an unfortunate parsing bug in Visual Studio 2005 design-time.

With the upcoming v1.0 release our goal was to once again fully support Visual Studio 2005. We've made the decision to roll-back the change and go back to <Content>.

I apologize for the breaking change.

Converting back to <Content> is a relatively simple process using a Visual Studio case-sensitive search. Just search for and replace the following string...


... with ...


Including the closing ">" angle-bracket will pick up both opening and closing tags.

This change is only included as of the v1.0 release.

Oct 19, 2009, 3:36 PM
Isn't your instruction the opposite of what we are trying to do? I thought we are replacing Body> with Content> ????

Oct 19, 2009, 4:29 PM
jchau (10/19/2009) Isn't your instruction the opposite of what we are trying to do? I thought we are replacing Body> with Content> ????

Ya, you're right. Sorry about that. I'll fix the above post.

Oct 19, 2009, 4:31 PM
I added the following note to the CHANGELOG.txt under item #45.

Renaming all <Body> tags in a project to <Content> can be easily
accomplished with a case-sensitive search and replace within Visual
Studio. Please search for the following (remove double quotes) and
ensure you have the "Match case" option checked.

Find what: "Body>"
Replace with: "Content>"