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
60
Format / Style Individual cells of WebDataGrid
posted

I need to control access to individual cells of a WebDataGrid based on a external datatable Used to build the grid column and rows.   The grid is being used to place orders based on Product availablitiy.   Basically controlled by two values (one drives columns with first column in grid containing the value that will control the rows sort of like x and y coordinates where first col is the Y values and the columns are the x values)  I have to build the grid based on a product selection and not all X, Y combinations are available.

available x1 x2 x3 x4
y1        
y2        
y3        
y4        
y5        
y6        

The light bluegreeen cells are available, but the black cell are not available.    I would like to be able to disable editing the the black cells and either shade the cells black ro remove all formating so that they are hidden.

available x1 x2 x3 x4
y1        
y2        
y3        
y4      
y5    
y6  

I have a css where I set the background color to black:

 .pwrsGridCellNotAvail {background-color: Black}

and in the initializeRow event I have set the style to:

e.Row.Items(colInd).CssClass &= " pwrsGridCellNotAvail"

 

 

 

but the grid does not take my css.  I have tried doing the same in a sub called after I bind the datasource to the datatable for the grid.

 I have done this before in another application using the UltraWebGrid, but the WebDataGrid does not seem to be as flexible, but could be missing something.  Please help.

When do I set the WebDataGrid individual cells to readonly and shade them black or hide them (which is what I really want)

 

 

 

Parents
  • 49378
    Suggested Answer
    posted

    Hi Hoyadev,

    It has been a while since your post, however in case you still need assistance I would be glad to help.

    Regarding making only some cells in a column non-editable:

    You could handle the EnteringEditMode event and based on your logic, cancel the event which will effectively make the desired cells uneditable.

    In order to style individual WebDataGrid cells, your CSS class should be defined as follows


    <style type="text/css">
    TBODY > TR > TD.YourClassName
    {
       
    background-color:Blue;
    }
    </style>

    Then you should be able to apply the styling by using for instance:


    e.Row.Items[3].CssClass = "YourClassName";

    Please let me know if you need further assistance.

    Best Regards,

    Petar Ivanov
    Developer Support Engineer
    Infragistics, Inc.
    http://www.infragistics.com/support

     

Reply Children
No Data