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
325
Selected Cell Style
posted

Is there a way to modify the formatting of a grid cell to have a different style when it is clicked/selected?

I can render a cell with conditional formatting (borders) on Page_Load but am looking for something either client side, or in the server side control creation.  Something like 'DisplayLayout.SelectedHeaderStyleDefault' but for a cell.

Is this possible?

I looked at the cell CSOM but couldn't see anything there that would help me.

Thanks in advance...

Parents
  • 7694
    Verified Answer
    posted

    Hello,

    You can use event CellClickHandler of ClientSideEvents and with JS code change color.

     

    APSX:
    <ClientSideEvents CellClickHandler="CellClick" />

     

    JS code:
       <script type="text/javascript">
            var oldCell = null;
            
            function CellClick(a, cellID, c) {
                if (oldCell != null) {
                    oldCell.Element.style.color = "Black";
                }
                var newCell = igtbl_getCellById(cellID);
                oldCell = igtbl_getCellById(cellID);
                
                newCell.Element.style.color = "red";
            }
    </script>

     

     

    Hope this helps.

Reply Children
No Data