views:

115

answers:

1

Ok, between following documentation, posts and videos that use syntax and tools that are no longer used or available, I'm really lost as to how to go about even using Telerik's OpenAccess. So I thought I'd ask for some help and hopefully someone out there has done this before.

I want to simply bind my OpenAccess entities to a RadGrid, but I want to use TemplateColumn in my RadGrid (in editmode, I want to use other controls like datepickers, dropdowns, etc.) Therefore, like the old way of doing things, I want to fire off the RadGrid's ItemDataBound event, for example, find the controls and set the controls to the appropriate values.

Old way that we were used to (You know, like the old fashioned way of something like setting a RadTextBox to a value from the RadGrid's DataSource, which was a DataReader:):

string strID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["campaignID"].ToString(); 
RadTextBox rtxtTitle = (RadTextBox)e.Item.FindControl("rtxtTitle"); 
rtxtTitle.Text = DataBinder.Eval(e.Item.DataItem, "title").ToString();

Does anyone have sample out there of how to do this? I would assume that I would also need to know how to bind the RadGrid in the first place, so an example of that would also be helpful (NOT using the actual OpenAccessDataSource control - I want to bind it in the NeedDataSource event of the RadGrid).

Thanks in advance...

A: 

The sample I found on the Telerik web site for DataBinding an OpenAccess result to a DataGrid looks like this:

IObjectScope scope = ScopeFactory.GetScope(HttpContext.Current);
string query = String.Format("SELECT * FROM {0}Extent", viewName);
IQueryResult result = scope.GetOqlQuery(query).Execute();

RadGrid1.DataSource = result.ToList();

This looks to be using OQL, but you could also use LINQ. I would toss this question to the OpenAccess team on the forums. They can probably point you to better resources.

Gabe