Welcome Guest Search | Active Topics | Sign In | Register

I need to call a function in every cell edit , kindly help me Options
Abid
Posted: Tuesday, April 26, 2016 8:55:14 AM
Rank: Newbie
Groups: Member

Joined: 3/15/2016
Posts: 6
function Summary() {

var grid = eo_GetObject("Grid1");
var colCount = grid.getColumnCount();
var rowCount = grid.getItemCount();

var sum = 0;
for (i = 1; i < colCount - 1; i++) {
for (RI = 0; RI < rowCount - 1; RI++) {
var a = parseFloat(grid.getItem(RI).getCell(i).getValue());
sum = sum + a;

}

var total = parseFloat(grid.getItem(rowCount - 1).getCell(i).getValue());
var columnName = grid.getColumn(i).getHeaderText();

if (sum - total>1) {


var c = sum - total;

alert('Difference of this ' + columnName + ' is ' + c);
return false;
}

sum = 0;

}

I need to call this function to every cell edit .
C# I am generating dynamically column for gridview
for (int i = 0; i < dt2.Columns.Count; i++)
{
string columnName = dt2.Columns[i].ToString();
TextBoxColumn obj1 = new TextBoxColumn();
obj1.Name = columnName;
obj1.HeaderText = columnName;
obj1.DataField = columnName;
Grid1.Columns.Add(obj1);
}
eo_support
Posted: Tuesday, April 26, 2016 10:09:47 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You can handle the column's ClientSideEndEdit event with JavaScript. However you can not call C# code directly from JavaScript code. It is possible to do it indirectly but you will have to refresh the whole Grid. So you may want to change your design not to rely on calling C# code every time you edit a cell.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.