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

Clientside binding of single columns

1 Answer 36 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Peter asked on 18 Jul 2012, 07:33 AM
I want to achieve the following:

The grid should display the result of a search request on our backend (this one is easy). But because 2 columns are difficult to compute, these columns are initially left blank. After the page with the grid is completely rendered to the user (with 2 columns beeing empty), he can begin working with the data. In the background (AJAX?) a second request to our server is submitted to get the values of the 2 missing columns. When the request returns the additional data, the corresponding columns are filled. Without interrupting the user.

Is this possible? And how? I don't find any documentation about clientside binding of single columns.

1 Answer, 1 is accepted

Sort by
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Jul 2012, 01:07 PM

Please check below demo.
function FillGridCOlumn() {
               var grid = $find("<%= RadGrid2.ClientID %>");
               if (grid) {
                   var MasterTable = grid.get_masterTableView();
                   var Rows = MasterTable.get_dataItems();
                   for (var i = 0; i < Rows.length; i++) {
                       var row = Rows[i];
                       var IdKey = row.getDataKeyValue("ID")
                       $(row.get_element()).find("span[id*='Label1']").get(0).innerHTML = "Your New Value " + IdKey;
               return false;

<telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid2_NeedDataSource"
          <MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID">
                  <telerik:GridBoundColumn HeaderText="ID" DataField="ID" UniqueName="ID">
                          <asp:Label ID="Label1" runat="server"></asp:Label>
 <br />
        <asp:Button ID="Buttontest" runat="server" Text="SetColumnValueOnClient" OnClientClick="return FillGridCOlumn();" />

protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
       dynamic data = new[] {
               new { ID = 1, Name ="Name1"},
               new { ID = 2, Name = "Name2"},
               new { ID = 3, Name = "Name3"}
       RadGrid2.DataSource = data;

If you are note able to find control in Grid then please check below link.

Jayesh Goyani
Asked by
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question