User-Custom Column Width

I notice when I use your examples that if I (as a user not in code) change the column widths and then do a sort yours keeps the column widths as I set them. Did you specifically write code for this in the post back or is ther a variable i need to toggle some where?

Edit:

It seems this only happens when I have edit mode set to false. Is there anyway we can have this enabled as a property? I need a read only view that people are going to want to resize and sort columns.

Hi,

Thanks for considering Aspose.

Are you using Aspose.Grid component? If so, which examples you are talking about. Could you elaborate your issue and give us details, so that we may check and resolve your issue soon.

Thank you.

This is concerning Aspose.Grid.Web control and I've narrowed it down it does not save the column width when you are in read-only mode and doing a postback.

The issue is we are using your control for a read-only view where users may still want to shrink and grow columns (which your control does great), but if you sort the columns by clicking on the row header it loses the custom sizes that they set. I think it would be beneficial for the column widths to stay the same when the user is just doing a postback view of the same information.

The best way to understand what I mean is to use your control and make a grid in readonly mode and an editable grid containing the same information. Resize one column on each grid (both with user column resizing enabled) and cause a postback by sorting or going to a different page if you enabled that. You'll notice the first grid reverts to its original column widths while the second grid maintains at the user resized state. The later is our desired functionality.

You can also try this on your demo page by entering data in the edit mode, resizing a column, clicking on the evaluation warning, click back on sheet 1 and you'll notice the columns are th same, then change to read only mode and resize a column and then click on evaluation warning and back again and the columns have reverted back negating your change.

While reviewing your control there are also a couple other things we noted that our users will ultimately need. They are:

  1. Forward and backward arrows in addition to the dropdown menu to switch between Pages (not worksheets)
  2. Alternating Row colors (we could code this if necessary, just a feature a lot of controls have)

Thanks for your outstanding service behind all of your products.

Hi,

Well, by default in Read-Only mode of the grid you may not be able to adjust Column width and Row height. we can support it and add the feature according to your demand but we have to check its feasibility and effectiveness.

  1. Forward and backward arrows in addition to the dropdown menu to switch between Pages (not worksheets)

Before will add other controls, I think you may try to use CustomCommandButton and the GridWeb.CurrentPageIndex property to change the page. For adding custom command buttons, you may use "Custom Command Buttons" editor. For ref, please check the source of Data Binding demos: Aspose.Grid Demos

  1. Alternating Row colors (we could code this if necessary, just a feature a lot of controls have)

Well, you may do it in two ways:

i). Select the row by clicking the row header of the grid, right-click to get the context menu and click "Format Cells" option and set your desired background color, borders etc.

ii). You may code it also:

/Create a style.
TableItemStyle itemStyle = new TableItemStyle();
itemStyle.BorderStyle = BorderStyle.Solid;
itemStyle.BorderWidth = 2;
itemStyle.BorderColor = Color.Blue;
itemStyle.BackColor = Color.Yellow;
itemStyle.ForeColor = Color.Red;

//Apply to second row.
for (int i = 0;i<10;i++)
{
GridWeb1.WebWorksheets[0].Cells[1,i].Style.CopyFrom(itemStyle);
}
Thank you.