This is a migrated thread and some comments may be shown as answers.

Problem with Client Side Update in RadGrid

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Venkat
Top achievements
Rank 1
Venkat asked on 28 Nov 2010, 02:06 AM
 

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

1 Answer, 1 is accepted

Sort by
0
Venkat
Top achievements
Rank 1
answered on 28 Nov 2010, 02:27 AM

$find(totalAmount).set_value(total);

 the above line did the magic..

Thanks..
Tags
Grid
Asked by
Venkat
Top achievements
Rank 1
Answers by
Venkat
Top achievements
Rank 1
Share this question
or