Aug 21, 2013, 3:20 PM
[CLOSED] Text overflow in column with ellipsis
I am trying to get a hidden text overflow with ellipsis in a column layout panel with containers as column. But somehow no solution I found is working. I am sure I missed an important detail... I commented out the tries I mad and which didn't work.
demo.aspx:
demo.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="demo.aspx.cs" Inherits="demo" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form" runat="server">
<ext:ResourceManager ID="ResourceManager" runat="server" />
<ext:Viewport runat="server" ID="vp">
</ext:Viewport>
</form>
</body>
</html>
demo.aspx.csusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
public partial class demo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
// Build Panel and add items
Ext.Net.Panel panel = this.BuildColumnPanel("PANEL", 4);
this.vp.Items.Add(panel);
// change text of second column label
Ext.Net.DisplayField df = this.FindControl("dfPANEL_2") as Ext.Net.DisplayField;
df.Text = "This text is too long and should be hidden at the end of the line with ellipsis!";
//df.OverflowX = Overflow.Hidden; //--> not working
//df.FieldStyle = "color: red; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;"; //--> not working
}
}
private Ext.Net.Panel BuildColumnPanel(string id, int numberOfColumns)
{
Ext.Net.Panel panel = new Ext.Net.Panel
{
Title = id,
ID = "pnl" + id,
ManageHeight = true,
Width = 800,
BodyPaddingSummary = "5 10 5 10",
Layout = "Column"
};
for (int i = 1; i <= numberOfColumns; i++)
{
panel.Items.Add(this.BuildColumnContainer(id, i, numberOfColumns));
}
return panel;
}
private Ext.Net.Container BuildColumnContainer(string id, int columnNumber, int numberOfColumns)
{
Ext.Net.Container columnContainer = new Ext.Net.Container
{
ID = "col" + id + "_" + columnNumber,
ColumnWidth = 1.0 / numberOfColumns,
Items =
{
new Ext.Net.DisplayField
{
ID = "df" + id + "_" + columnNumber,
FieldLabel = "Column",
Text = "#" + columnNumber
}
}
};
return columnContainer;
}
}
Thanks for any tips.
Last edited by geoffrey.mcgill; Aug 26, 2013 at 10:43 PM.
Reason: [CLOSED]