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
95
ItemCommand Not getting Fired after CellClickHandler (client side coded) execute
posted

Hi,

I have ItemCommand as the server side event for the grid. It works fine without any problem.

When i add the client side event for the grid the server side events are not getting fired. I have added CellClickHandler and i have just put an alert message. When i click on the grid cell only the cellclick handler client side event is fired. The server side ItemCommand is not getting fired. 

I doubt there is some kind of return value has to be sent on client side javascript so that the ItemCommand server side event gets fired. Please find by code below.

The javascript method works without any problem. The problem i face is after the clientside script execution the server side code is not called. I have placed a break find on the server side code of ItemCommand but it never gets fired.  If i run the code without having the client side events the server side method Itemcommand gets fired. So i doubt i have set some kind of value so that after the client code is excuted it will fire the server side events. I would really appericate if you any one can help me on this.

Client side CellClickHandler

<script id="igClientScript" type="text/javascript">
    <!--
        var oGrid;
        var selectGridCell;
        var RejectGridCell;
        var SubmitGridCell;
       
       function onCellClick(gridName, cellId, button)
       {
           var oRow = igtbl_getRowById(cellId);
           var cell = igtbl_getCellById(cellId); 
           var index = cell.Index; 
           var State = oRow.getCellFromKey('Status');
           var Id = State.getValue();
          
           if (cell && cell.Band.Index === 0)
           {
               if (index == 0 && Id == 'Completed')
               {
                   alert('The Ticket has been Billed');
                   return true;                    
               }                             
           }
       }                                  

        -->
    </script>

ItemCommand server side code.

 

 

 

 

 

 

 

 

 

 

protected void ugrdSearchList_ItemCommand(object sender, Infragistics.WebUI.UltraWebGrid.UltraWebGridCommandEventArgs  e)

{

 

Response.Redirect(<some x page>);

}

  • 2907
    posted

    Hi,

     

    I think the client side CellClick or ClickCellButton events should not be fired while you click on button created inside template column.

     

    To handle the client side events for button which generates item command, you need to use different mechanism.

     

    This is small summary of controls and their events as per my understanding

     

    (1)   Template column button

    Client side events: Use OnClientClick or onClick attribute of Button or other control in the template which generates ItemCommand event

    Server side event: grid’s OnItemCommand event

     

    (2)   Grid button ( Using column type = button)

    Client side event: use ClickCellButtonHandler

    Server side event: grid’s OnClickCellButton event

     

    (3)   Cell click (click on cell area)

    Client side event: use CellClickHandler

    Server side event: grid’s OnClick event

     

    If you create a sample and upload then it will help to analyze the actual issue. Or simply you can provide definition of grid also.

     

    Greetings