View Full Version : [CLOSED] How To set FitHeight=true for Columnlayout on codebehind?

Dec 22, 2019, 12:01 PM

I'm in the process of migrating to EXT.Net 5, but I'm struggling to know how to set FItHeigth = true on a ColumnLayout, in older versions This was a property of the columLayout, but I do not find what is the equivalent on EXT.Net 5 as it does not appear as an option on ColumLayoutConfig

ViewPort vp = new ViewPort();
//these 2 lines does not seem to make the trick
ColumnLayoutConfig clcfg=new ColumnLayoutConfig();

Panel mainPanel=GetMainPanel();
Panel btnsPanel=GetButtonsPanel();
return vp;

I'm sure that it is a simple thing, but I do not find out how to set it.


Dec 22, 2019, 3:01 PM
Hello @jcanton!

You are migrating from Ext.NET 1 to 5, right?

I see references to the config option you mentioned (FitHeight) in the ColumnLayout Example from Ext.NET 1 examples explorer (https://examples1.ext.net/#/Layout/ColumnLayout/Basic/).

It seems the column layout lost that feature since 1 to 2 version upgrade. If you searched forums, you'd see a few threads about situations where it didn't work well still in version 1; and that might have been the reason it couldn't survive version 2 of Ext.NET.

Good news is that you have more than one different ways to reproduce the same layout with other approaches.

From the example in Version 1 (https://examples1.ext.net/#/Layout/ColumnLayout/Basic/), I could attain the same visual result if I changed the layout to BorderLayout; in case you are also using three columns, this should work for you.

From the example linked above, I could get this equivalent in version 5:

<%@ Page Language="C#" %>

<!DOCTYPE html>

<head runat="server">
<title>Column Layout - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<ext:ResourceManager runat="server" />

<ext:Viewport runat="server" Layout="BorderLayout">
Html="This is some content."
Html="This is some content."
Html="This is some content."

This will basically work if you have just three columns in whatever container you are placing the items (viewport, panel, container).

In case you have an arbitrary amount of columns, you might want to use the HBox layout instead. It supports the same "flex" weight as above. Just instead of being a float, you'd use an int. In the original example, we had 0.25 and 0.75 as ColumnWidth; this translates to 1 and 3 in Flex "language".

There's a topic of particular interest for your question, which we recommended to use HBoxLayout, here: ColumnLayout and FitHeight (https://forums.ext.net/showthread.php?23120).

Hope this helps!

Dec 23, 2019, 5:48 PM

I'll change the layout.

Actually I'm migrating 1.x and 3.x code. This option was also available in 3.x. But there is no problem I can change to other layout.


Dec 24, 2019, 4:16 PM

The following suggests the setting was no longer available since version 2 of Ext.NET:

- ColumnLayout example in v1 (https://examples1.ext.net/#/Layout/ColumnLayout/Basic/)
- ColumnLayout example in v2 (https://examples2.ext.net/#/Layout/ColumnLayout/Basic/)

If you look both examples' source code, you'll notice the newer version no longer uses any reference to the FitHeight keyword.

So I believe you could probably have kept the property set in the ASPX code for version 3, it would actually be brought out to client-side, but had no effect to the built page. You would suffer the same code behind issue if you tried to use it in Ext.NET 3 code.

Regardless of that, the last post remains your best choice to keep a consistent layout. Ext.NET 1 suffered the most breaking changes (between versions 1 and 2), since the code was still being consolidated. From between v2 to v3 to v4 to v5, a much smaller set of structural changes took place and migration should be much easier if compared to v1.

Hope this helps, and count on us if you need further help in the migration process!

Jan 24, 2020, 6:03 PM
Hello @jcanton!

Did changing the layout work for you in the problem, or do you still need assistance with this issue? I'm sorry this lost setting caused you some headache in the migration, but there been long discussions about this and there were some technology boulders preventing it from being feasible, exactly for layout issues, especially as responsive layouts became a thing.

We may mark this thread as closed if you don't post back in 7+ days from now, but falter not, as we don't lock up threads, you will still be able to post here even after the 'closed' tag is in place and we can continue the discussion.

Looking forward to your feedback!