Click here to Skip to main content
14,699,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to do some calculation on my grid columns. Here is my approach.
In my grid I have 2 textboxes in item template and one bound field. and Bound field is prepopulating from database.
textbox1 + textbox2 = boundfield.
when user enter data in textboxes, my bound field need to be updated automatically.
Appreciate if anyone can send me sample code help me to apply this using
Its very urgent. Thanks in advance
Updated 3-Mar-11 20:37pm
Monjurul Habib 4-Mar-11 2:04am
did you try anything? share your code.
Rohit.Net100 4-Mar-11 12:14pm
Hi tried with below code, but getting error 'Conversion from string "return show('" to type 'Double' is not valid.'
please help...
vb code:
Private Sub GD_Prod_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles GD_Prod.ItemCreated
If TypeOf e.Item Is GridDataItem Then
Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
Dim txtbox1 As TextBox = DirectCast(item.FindControl("TxtSTUPort"), TextBox)
Dim txtbox2 As TextBox = DirectCast(item.FindControl("TxtAAPort"), TextBox)
txtbox1.Attributes.Add("onblur", "return show('" + item.ItemIndex & "')")
txtbox2.Attributes.Add("onblur", "return show('" + item.ItemIndex & "')")
End If
function show(index) {
var grid = $find("<%=GD_Prod.ClientID %>");
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[index];
var Value1 = row.findElement("TxtSTUPort").value;
var Value2 = row.findElement("TxtAAPort").value;
var cellValue = parseInt(Value1) + parseInt(Value2);
MasterTable.getCellByColumnUniqueName(row, "STD_NUM_OF_SERVING").innerHTML = cellValue;

1 solution

Hope this[^] article might help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900