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

Read all data at client side from the RadGrid - batch edit mode

1 Answer 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 15 Jun 2015, 07:56 AM

How can I get all data from the RadGrid at client side to build a json string with the new data?

using the following code I Tried 

01.<telerik:GridTemplateColumn UniqueName="ColDepartment" DataField="DepartmentId" HeaderStyle-HorizontalAlign="Left">
02.<ItemTemplate>
03.      <asp:Label ID="DepartmentNameLbl" runat="server" Text='<%#Bind("Department.Name") %>'></asp:Label>
04.</ItemTemplate>
05. 
06.<EditItemTemplate>
07.      <telerik:RadDropDownList runat="server" ID="DepartmentsDdl" DataValueField="Id" DataTextField="Name" OnPreRender="DepartmentsDdl_PreRender"></telerik:RadDropDownList>
08.        </EditItemTemplate>
09.
</telerik:GridTemplateColumn>

1.batchManagerObject.getCellValue(cellObject);

but it gives me the displayed value [DepartmentName] What I need is the [DepartmentId]

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 18 Jun 2015, 06:02 AM
Hello,

Is the department id used for another column or set as a ClientDataKeyName? If not the only way to obtain it is to use the DepartmentName to find the respective RadDropDownList  item and obtain the id. An exemplary implementation of this approach is available below.

JavaScript:
var departmentName = batchManagerObject.getCellValue(cellObject);
var item = $telerik.findControl(document,"DepartmentsDdl").findItemByText(departmentName);
var id = item.get_value();


Regards,
Angel Petrov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or