TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kaunainbaig kaunainbaig
NA
111
93.3k
invoking keyup for javascript method in dynamic created textbox with dynamic name
Oct 6 2009 3:55 PM
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.
Reply
Answers (
4
)
multiple .cs files using shared method, using form name as a parameter
problem with moving objects in 2d array