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

A question about the demo

2 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lin
Top achievements
Rank 1
Lin asked on 23 Mar 2012, 04:49 PM
Hello,

I have just read this demo:http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx .
In this demo,the "Category" column is not a field in table [Products] ,but in table [Categories ].And the demo use the following code to show the category's name accurately:
<telerik:GridDropDownColumn DataField="CategoryID" DataSourceID="SqlDataSource2"
                    HeaderText="Category" ListTextField="CategoryName" ListValueField="CategoryID"
                    UniqueName="CategoryID" ColumnEditorID="GridDropDownColumnEditor1">
                </telerik:GridDropDownColumn>

But now I have 3 tables in my datebase,for example,table A,table B and table C.Table A has a foreign key pointing to table B.And table B has a foreign key pointing to table C.Now I want to show A.X,B.Y,C.Z in a grid and realize the insert/update/delete functions.How to?

In addition,if I use dropdownlist to show B.Y and C.Z,I have to deal with the SelectedIndexChanged event to refresh the other dropdownlist.

It seems that my question is a little stupid.Let me give an example.Now I have to manage the students' information.Each student comes from different college,and has their major.Each major is in different college.Now I have 3 tables:[Students],[Majors],[Colleges].[Students].MajorID is a foreign key pointing to [Majors].  [Majors].[CollegeID] is a foreign key pointing to [Colleges]. [Majors].Name is the name of a major and [College].Name is the name of a college.Now I want to use a grid to show/insert/update/delete students.

My current solution is to use other pages for insert/update,is there a faster way?
 
Thanks very much.

2 Answers, 1 is accepted

Sort by
0
LV
Top achievements
Rank 1
answered on 24 Mar 2012, 07:15 AM
kan bu dong
0
Andrey
Telerik team
answered on 29 Mar 2012, 08:23 AM
Hello,

Category column uses CategoryID field which is foreign key to the Categories table and it is presented in the Products table. You could check the attached image file for better overview.

You could achieve your goal by joining the three tables in one resulting table. Thus you will be able to access the fields from all tables.

About  the related combo boxes question you could check this online demo application.

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Lin
Top achievements
Rank 1
Answers by
LV
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or