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
498
add a onmouseover handler to a row in a webgrid on the client side
posted

I'm trying to change the background color of a row in a webgrid onmouseover on the client side. Is there a way to do this.

Thank you.

Parents
No Data
Reply
  • 7694
    Verified Answer
    posted

    Hello,

    You can use the ClientSideEvents of UltraWebGrid and use events MouseOverHandler="Over" MouseOutHandler="Out" . With javascript function over and out you can manipulate background of rows:

    <ClientSideEvents MouseOverHandler="Over" MouseOutHandler="Out"/>

    ...

    <script type="text/javascript" language="javascript">   

        function Over(gridNane, cellID, objectType){       

            var cell = igtbl_getCellById(cellID);

            setRowBackColor(cell.Row, "red");        

        }

        function Out(gridNane, cellID, objectType){       

            var cell = igtbl_getCellById(cellID);

            setRowBackColor(cell.Row, "white");    

        }

        function setRowBackColor(row, color){

            var cells = row.getCellElements();       

            for (var i = 0; i < cells.length; i++) {

                cells[i].style.backgroundColor = color;       

            }  

        }

        </script>

    ...

     

     

     

Children