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

Bind data to grid according to selected row in other grid

2 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Covertix
Top achievements
Rank 1
Covertix asked on 14 Sep 2014, 02:49 PM
I have 2 grids:

The first one displays tasks and the other one displays tasks settings.

I want to bind data to the second grid based on the selected task id (selected row of the first grid).

Is there any way to implement this functionality?

2 Answers, 1 is accepted

Sort by
0
Covertix
Top achievements
Rank 1
answered on 14 Sep 2014, 03:49 PM
I tried:

<telerik:RadGrid ID="rgTasks" runat="server" OnNeedDataSource="rgTasks_NeedDataSource" Skin="Gray" AutoGenerateColumns="false" OnSelectedIndexChanged="rgTasks_SelectedIndexChanged">

    protected void rgTasks_SelectedIndexChanged(object sender, EventArgs e)
    {
        String ID = rgTasks.SelectedValue.ToString();
        rgTaskData.DataSource = GetData(ID);
        rgTaskData.DataBind();
    }


But rgTaskData remains empty





0
Eyup
Telerik team
answered on 17 Sep 2014, 06:58 AM
Hi Tzach,

Please note that using DataBind() to bind the grid is not recommended. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding


As for your main requirement, I suppose you are looking for something similar to this:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/master-detail/defaultcs.aspx

Or this:

http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/partialajaxification/defaultcs.aspx


I'm also sending a sample RadGrid web site to demonstrate a basic implementation. Please run the attached application and let me know if it helps you.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Covertix
Top achievements
Rank 1
Answers by
Covertix
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or