Hi WiseJ,
how to properly autoresize column in the listview, if the inner control of the ListviewItem is a LinkLabel? The ListView has its property View set to Wisej.Web.View.Details mode.
Consider the following code fragment, and it does not work as expected. Please advice how to do it.
*****
this.listView1.Items.Clear();
for (int i = 0; i < 32; i++)
{
var item = this.listView1.Items.Add(“”);
item.Control = new LinkLabel()
{
Text = $”label text test {i}”,
AutoSize = true
};
}
this.listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
*****
Thank you
Pavel Weiss
Hi Pavel,
Attached is a modified version of your sample.
Like Luca mentioned, it’s best to use HTML rather than using a LinkLabel in a ListViewItem.
You can either use regular HTML links or you can have multiple links in a single item using the “Role” attribute.
The sample include both of these approaches.
PS: for the second ListView, make sure that you click over the “roles” text to see the functionality!
HTH,
Alaa
//
The column auto resize ColumnContent is based on the column content. It doesn’t use the item’s hosted control.
A better way to show a link in a cell is to use HTML content and handle the click.
Frank, please see attached demo project.
Hi Pavel,
can you please wrap up a complete sample that we can run on our end?
What does “not work as expected” mean? Does it not resize at all, incorrect size, etc?
Best regards
Frank
Please login first to submit.