invoking keyup for javascript method in dynamic created textbox with dynamic name
i used this code to create textboxes
txtCost = new TextBox();
txtCost.ID = "txt" + dtjCostCenter.Rows[i]["int_CostCenterId"].ToString();
txtCost.MaxLength =12;
//txtCost.Text = dtjCostCenter.Rows[i]["int_CostCenterName"].ToString();
phcosts.Controls.Add(new LiteralControl("<td>"));
phcosts.Controls.Add(txtCost);
AjaxControlToolkit.FilteredTextBoxExtender ftbx = new AjaxControlToolkit.FilteredTextBoxExtender();
ftbx.ID="ftb" + dtjCostCenter.Rows[i]["int_CostCenterId"].ToString();
ftbx.ValidChars = "1234567890.";
ftbx.TargetControlID = "txt" + dtjCostCenter.Rows[i]["int_CostCenterId"].ToString();
ftbx.FilterType = AjaxControlToolkit.FilterTypes.
about 5 textboxes are created . now the thing is that i want to calculate auto sum of every textbox on keyup event and place that in total label. i have performed this thing with the non dynamic textboxes with non dynamic name
like this with javascript function being called on keyup
script language="javascript">
function sum() {
var mySum = 0;
var value1 = parseInt(document.getElementById("TextBox1").value);
var value2 = parseInt(document.getElementById("TextBox2").value);
var value3 = parseInt(document.getElementById("TextBox3").value);
if (value1 > 0) {
mySum = mySum + value1
}
if (value2 > 0) {
mySum = mySum + value2
}
if (value3 > 0) {
mySum = mySum + value3
}
document.getElementById("TextBox4").value = mySum
}
now how would i invoke keyup in my c# code to invoke the sum method.