Click here to Skip to main content
16,018,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way to create dynamic columns in Listview at runtime?

Thanks in advance
Posted

Yes.

I should have stopped right here based on the question, but... here you go for more info: GS Result[^]
To start with, a similar discussion here.[^]
 
Share this answer
 
Comments
Espen Harlinn 6-Feb-11 11:09am    
Well, 72,400 options to choose from, should definitely help, my 5
I have the same problem and no good enough solution for now.
Previous "solutions" are usually for .NET C#, but as far as I understand, ListView.Columns is not available for ASP.NET
 
Share this answer
 
C#
private void AddColumn(ListView lv, string title, int width)
{
    ColumnHeader column = new ColumnHeader();
    column.Text = title;
    column.Width = width;
    lv.Columns.Add(column);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900