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

Database example

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 17 Aug 2014, 04:01 PM
I'm having a hard time finding an example of a gridview pulling data from a database. I've looked through the SDK, documentation, and google results for hours to no avail. This really should be easier to find as it has to be a very common request. While I'm at it, there should definitely be an example of this in the SDK (if it's already there, it's not obvious).

I want to do something that should be really easy:
1) Use a datagrid to view rows in a database
2) add/modify rows using buttons and another window
3) filter and sort

I found this overview to help explain what should happen, but I have no idea how to actually implement it: http://www.telerik.com/help/wpf/entityframework-overview.html

I don't fully understand all the differences between MVVM, code behind, etc., but the key statement from the link that I want to implement is this: "All operations such as paging, filtering, sorting, and grouping will automatically happen on the server without a single line of code." I'm guessing insert and update operations will require some code, but maybe not.

I have entity 6.1.x, telerik SDK, and an mssql database with example data already setup. I also have a project based on an example in the SDK that compiles and runs with no issues. All of the pieces should be in place, but I'm missing the critical component that explains how to transact data with entity/databases/whatever it's called.

2 Answers, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 17 Aug 2014, 05:08 PM
Also, I've followed this example, but the end result doesn't compile: http://docs.telerik.com/data-access/quick-start-scenarios/wpf/quickstart-wpf-overview

I couldn't find a completed solution for that and the code I copied exactly won't compile. I can probably use that tutorial to help with what I want to do, but I need to figure out the database component first. After data is pulled from a mssql database through entity, then I can worry about inserts, updates, etc. unless there's a way to handle all of it at once.

Here's a link to my project: http://pseglobal.com/project.zip

The GetReports function is working, but that's obviously not how I want to get the data. In the database scripts folder, there are a few scripts that will build a close enough approximation of my real database for this example.
0
Dimitrina
Telerik team
answered on 18 Aug 2014, 09:12 AM
Hello,

You can check the "Various Data Sources" SDK example. Basically, the approach for populating data from the server is the same as with MS DataGrid control or any other items control. There is nothing specifically related to RadGridView. 
As to the data operations, they will work similarly no matter if your data is in memory or not. 

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or