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
4160
How to Disable/Enable button depending on Selected Row's cell value (Client Side)
posted

Hello

I have a Webgrid inside a WARP and a WebImageButton outside it. I would like to handle the Client-Side AfterSelectChange event of the grid in such a way that if the value of the "HasPDF" cell of the selected row is 1 the button has to be enabled and disabled otherwise, having that there is single selected row (the button has to be disabled if there is not a single selected row).

Since I do not know much of CSOM, I would appreciate any coding help you can give me.

Thanks a lot.

 

 

 

 

 

Parents
  • 2907
    Suggested Answer
    posted

    Hi,

     

    Try this code.

     

    (1)   Adding event handler

    <ClientSideEvents 

    AfterRowActivateHandler="grid_AfterRowActivate" />

    (2)   function

            function grid_AfterRowActivate(gridName,rowId)

            {

                var row = igtbl_getRowById(rowId);

                var imgButton = ig_getWebControlById("<%= WebImageButton1.ClientID %>");

                if(row.getCellFromKey("HasPDF").getValue() == 1)

                    {

                        imgButton.setEnabled(true);

                    }

                else

                    {

                    imgButton.setEnabled(false);

                    }

            }   

     

    I think you also need to select first row at first time load. You can handle this in Initialize layout handler event.

     

    Let me know if this helps you.

    Greetings

Reply Children