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

RadGrid Editing using Entity Framework Causing Error

1 Answer 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Grooverinthesouth
Top achievements
Rank 1
Grooverinthesouth asked on 09 Dec 2008, 12:33 PM

I have two tables.
STAFFMEMBER
StaffNumber : int PK
FirstName : nvarchar(50)
LastName : nvarchar(50)
TeamID : int FK

TEAM
TeamID : int PK
TeamName : nvarchar(50)

Using the entity framework and RadGrid (2008.3.1105) I am attempting to edit the staff members. Retreiving the list of staff members requires me to include the Team object in oder to update and view the team they belong to. I therefore have to use an object query instead of the EntityDatasource (which works) to navigate the object graph.

In my StaffGrid_NeedDataSource method I have the following code:

protected void Grid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
{  
    StaffGrid.DataSource = context.StaffMembers.Include("Team").OrderBy(p=>p.LastName);  

When I select a row to edit via a LinkButton, with CommandName="Edit" I get the following error:
"The ObjectContext must be configured by 1) defining ContextTypeName, 2) defining both ConnectionString and DefaultContainerName, 3) defining ContextType, or 4) supplying it in the OnSelecting event."

These attributes in the error are defined in an EntityDataSource which I am not using due to my customised object query.
I have been using RadGrid for a long time with the ObjectDataSource and am moving to the Entity Framework.

What exactly am I missing or is this not fully supported?

1 Answer, 1 is accepted

Sort by
0
Grooverinthesouth
Top achievements
Rank 1
answered on 10 Dec 2008, 10:36 AM
Please ignore this post... Silly error.
The team dropdownlist in my edittemplate was bound to an EntityDatasource to populate for editting which was not configured properly and causing the error when attempting to bind.

All working now.
Tags
Grid
Asked by
Grooverinthesouth
Top achievements
Rank 1
Answers by
Grooverinthesouth
Top achievements
Rank 1
Share this question
or