Dear All,
I am new to Telerik RAD Controls and new to this forum too...
Actually,
I am using a Telerik Rad Grid. With in the detail grid, I got various columns, say col1 and col2, col3. When the user entered a value in col1 and col2, I should add them and set to the col3.
In the itemdatabound event I have added code to add javascript method to get fired onfocuschange of col1 and col2
var
col1 = item["col1"].Controls[0] as RadNumericTextBox;
var col2 = item["col2"].Controls[0] as RadNumericTextBox;
var col3 = item["col3"].Controls[0] as RadNumericTextBox;
string clientIds =
"'" + col1.ClientID + "' ," +
"'" + col2.ClientID + "' ," +
"'" + col3.ClientID + "'";
col1.Attributes.Add(
"onfocusout", "javascript:calculate(" + clientIds + ");");
col2.Attributes.Add(
"onfocusout", "javascript:calculate(" + clientIds + ");");
The following is the javascript method:
<
script type="text/javascript" language="javascript">
function calculate(price, quantity, totalAmount) {
var text1 = document.getElementById(price);
var text2 = document.getElementById(quantity);
var text3 = document.getElementById(totalAmount);
var total = text1.value * 1 + text2.value * 1;
alert(total);
alert(document.getElementById(totalAmount));
document.getElementById(totalAmount).value = total;
return true;
}
</script>
The javascript method is getting fired,and I am able to read the value entered by the user in the col1 and col2. How ever, when I set it to col3, it is not getting updated.
It is urgent, any ideas, please?
Regards,
Venkat