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
Client Side: CheckBox Validation in Webgrid
posted

Hi,

I have two unbound checkbox column in the web grid. Only one of the checkbox should be selected for each row.

Problem:  I am calling the client side method  AfterCellUpdateHandler . Only this event gets fired when i check/uncheck the checkbox.

When the user checks the checkbox1 i want to uncheck the checkbox2 and vice versa. Whenever i uncheck the second checkbox its calling the "AfterCellUpdateHandler" again and again.

Please find my code below. I would appreciate help.

code:

 

function AfterCellUpdateHandler(gridName, cellId, button)

{

 

var oRow = igtbl_getRowById(cellId);

 

var cell = igtbl_getCellById(cellId);

 

var index = cell.Index;

 

var IsReject = new Boolean();

 

var IsSubmit = new Boolean();

 

 

// Checking for the cell Index

 

// The below method will be executed only for Index 0 & 1

 

RejectGridCell = oRow.getCellFromKey(

'Reject');

SubmitGridCell = oRow.getCellFromKey(

'Submit');

selectGridCell = oRow.getCellFromKey(

'CommodityCode');

alert(selectGridCell.getValue());

 

 alert(RejectGridCell.getValue());

alert(SubmitGridCell.getValue());

 

IsReject =

new Boolean(RejectGridCell.getValue());

IsSubmit =

new Boolean(SubmitGridCell.getValue());

 

 

 

if (cell && cell.Band.Index === 0)

{

 

if(index == 0 && IsReject == true && IsSubmit == false )

{

alert(

'Un Check the Submit ');

SubmitGridCell.setValue(0);

}

 

if(index == 1 && IsSubmit == true && IsReject == false )

{

alert(

'Un Check the Reject');

RejectGridCell.setValue(0);

}

}

}

Parents
  • 335
    Verified Answer
    posted

    Try the overloaded .setValue function.

    Use following:

    SubmitGridCell.setValue(0,false);

    This should not trigger the AfterCellUpdateHandler event again.

Reply Children
No Data