Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
495
Horizontal scrolling with columns sized to width of data
posted

Hi,

I would like to dynamically size the columns of a WebDataGrid to the width of the data.  This would also require that I allow for horizontal scrolling in cases where this exceeds the width of the grid.  Finally, this grid has paging enabled, so the footer would presumably need to remain stationary.  It's my understanding from reading other posts on this forum that this behavior is not supported from the WebDataGrid api.  However, would it be possible to accomplish this behavior through css modifications?  I haven't had any luck so far.  Any suggestions as to how to go about this would be appreciated.

 

Parents
No Data
Reply
  • 14049
    Offline posted
    Hello,

    This functionality is not supported in the UltraWebGrid. WebDataGrid
    should do fine.
    You need to set width on the control itself. Then leave the columns
    widths empty.
    At that point if you try to enter long strings into cells the grid will
    try to accommodate those by extending both width and height of the cell.
    If you'd like to keep the row height, so the text remain as one line try
    adding white-space:nowrap to the cells css class.
    Create a css class on the page:

    tbody.NoWrapCells > tr > td
    {
    white-space:nowrap;
    }

    and then set the ItemCssClass property:

    WebDataGrid1.ItemCssClass = "NoWrapCells";
Children