This is a migrated thread and some comments may be shown as answers.

Column Width

3 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 26 Jul 2011, 07:16 PM
What am I doing wrong. I have a grid with several columns. One column is text OCRed from a page and can be up to 2k alpha numeric character. Obviously I only want to show the first 50 or so. I'ved tried many suggestions but nothing seems to work. Here is the code for the one column:

 

 

GridBoundColumn gridColumn = new GridBoundColumn();

 

RadGrid1.MasterTableView.Columns.Add(gridColumn);

gridColumn.DataFormatString =

 

"<nobr>{0}</nobr>";

 

gridColumn.DataField = dataColumn.ColumnName;

gridColumn.HeaderText = dataColumn.ColumnName;

gridColumn.HeaderStyle.Width =

 

Unit.Pixel(125);

 

gridColumn.ItemStyle.Width =

 

Unit.Pixel(125);

 

gridColumn.FooterStyle.Width =

 

Unit.Pixel(125);

 


3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Jul 2011, 06:04 AM
Hello Fred,

I am not quite sure about the issue that doesn't seems to work for you.Here is the following code snippet which I tried and worked as expected.
protected void Page_Init(object sender, EventArgs e)
  {
        ....  ....  ....   ....    ....
     GridBoundColumn gridColumn = new GridBoundColumn();
     RadGrid1.MasterTableView.Columns.Add(gridColumn);
     gridColumn.DataField = "ColumnName";
     gridColumn.HeaderText = "ColumnName";
     gridColumn.UniqueName = "ColumnName";
     gridColumn.DataFormatString = "<nobr>{0}</nobr>";
     gridColumn.ItemStyle.Width = Unit.Pixel(500);
       ....  ....  ....   ....    ....
  }

Thanks,
Princy.
0
Sebastian
Telerik team
answered on 27 Jul 2011, 09:39 AM
Hi guys,

Also verify that you enabled column resizing for the grid as illustrated on this demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/resizing/defaultcs.aspx (see the available configuration options via the checkboxes, too)

Best,
Sebastian
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Fred
Top achievements
Rank 1
answered on 27 Jul 2011, 02:27 PM
when I turn set resizable to true then I get even sizing for all the other columns. I guess I lose the luxury of the auto column sizing and will have to specify it for each column.
Tags
Grid
Asked by
Fred
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sebastian
Telerik team
Fred
Top achievements
Rank 1
Share this question
or