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

Update each label from Javascript.

2 Answers 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Grzesiek
Top achievements
Rank 2
Iron
Grzesiek asked on 11 Nov 2009, 05:39 PM
I have column:
        <telerik:GridTemplateColumn HeaderText="Profit"><ItemTemplate> 
            <asp:Label ID="profit" runat="server"></asp:Label></ItemTemplate
        </telerik:GridTemplateColumn> 

And I want to update each label in this column from JavaScript function.

For example, event onkeyup for some textbox outside the Grid.

After enter some value, all values in column Profit is changing.

How can I get this in Javascript and iterate through all cells in "Profit" column?


2 Answers, 1 is accepted

Sort by
0
Grzesiek
Top achievements
Rank 2
Iron
answered on 11 Nov 2009, 07:43 PM
Okey, I've done it, but I have still problem:

var masterTable = $find("<%=RadGrid1.ClientID%>").get_masterTableView();  
var cellText;  
for(var row = 0; row < masterTable.get_dataItems().length; row++)  
{  
    cellText = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[row], "profit").innerHTML;  
}  

I have also Textbox in template column and I can't get the value from this TextBox.

How to do this?
InnerHTML gives me "<span id= .... ></span>"

I want to get the value from TextBox in TemplateGridColumn and multiply by other value.

Anyone can help me?

0
Tsvetoslav
Telerik team
answered on 13 Nov 2009, 01:09 PM
Hi Grzesiek,

Once you have got a reference to the cell element, you can use the $telerik.findElement(...) to get the textBox by its ID. For example, your textbox has an ID of boxProfit, you should be able to obtain a reference to the textbox html element as follows: $telerik.findElement(cell, "boxProfit");

I hope this helps.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Grzesiek
Top achievements
Rank 2
Iron
Answers by
Grzesiek
Top achievements
Rank 2
Iron
Tsvetoslav
Telerik team
Share this question
or