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

OpenAccess and MVC Telerik Grid

4 Answers 128 Views
Integration with other products
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joan Vilariño
Top achievements
Rank 2
Joan Vilariño asked on 24 Feb 2011, 03:55 PM
Hi .. . I downloaded your latest trial for OpenAccess, and created a test project in Visual Studio 2010 / MVC3 against our Oracle database.

The call to Index works, and the results are shown, but the internal grid call to _select() fails (out of my action.. I guess in one of your filters) and gives an Internal Server Error 500 alert ...

Is there anything I'm doing wrong???

Copntroller:
public class HomeController : Controller
{
          
    public ActionResult Index()
    {
        // THIS ACTION WORKS...
        var db = new UsuariosDB();
        ViewBag.Message = "Welcome to ASP.NET MVC!";
        var result = db.Usuarios.Where(o => o.Nombre != null).OrderBy(o => o.Nombre).ToList();
        ViewBag.result = result;
        return View();
    }
    [GridAction]
    public ActionResult _select()
    {
        // THIS ACTION RETURNS 500 SERVER ERROR FROM THE GRID
        var db = new UsuariosDB();
        return View(new GridModel<Usuario>() { Data = db.Usuarios.Where(o => o.Nombre != null).OrderBy(o => o.Nombre).ToList() });
    }
}

View:
@using OpenAccessTest
@using OpenAccessTest.Controllers
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
    ViewBag.Title = "Index";
}
  
<h2>Index</h2>
<p id="main">
  
@{
  
    var lista = (List<OpenAccessTest.Usuario>)ViewBag.result;
     foreach (var usr in lista)
     {
         @Html.Label(usr.Nombre)<br />
     }
}
  
@(Html.Telerik().Grid<Usuario>()
                .Name("GridIngresos")
                .DataKeys(k => k.Add(o => o.Idusuario))
                .DataBinding(db => db.Ajax().Select<HomeController>(o => o._select()))
                .Sortable(s => s.OrderBy(o => o.Add(i => i.Idusuario)))
                .Filterable()
                .Reorderable(cf => cf.Columns(true))
                .Resizable(cf => cf.Columns(true))
                .Scrollable(sc => sc.Height(300))
                .Pageable(pg => pg.PageSize(50)) 
                .Selectable()
                .Columns(cl =>
                {
                    cl.Bound(o => o.Nombre); 
                }))
  
</p>

4 Answers, 1 is accepted

Sort by
0
Serge
Telerik team
answered on 02 Mar 2011, 12:01 PM
Hi Joan Vilariño,

 I am sorry for the late reply, as you know Q1 is coming close and we are packed with development.  We are investigating this issue but we have still not found the solution to your problem. We have successfully reproduced this behaviour and it is only a matter of time for us to find the answer. 

I will keep you posted about the progress, I am confident that we will have found the issue in the next couple of hours.

Regards,
Serge
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Serge
Telerik team
answered on 02 Mar 2011, 02:13 PM
Hello Joan Vilariño,

 The problem is that there is an OpenAccess exception that is thrown, this exception says that the context used by the object is already disposed. As you know all object retrieved from a object context need at some point to ask the context for more information or inform him for any changes that are made, and if the context is disposed this is a problem. 

You can work around this issue by implementing the context factory approach best practice for your application. You can find more information on this in this knowledge base article.

You can also have a look at the MVC Extensions troubleshooting guide, there is a whole section explaining this problem and possible workarounds.

I hope this proves to be helpful. Again sorry for any inconvenience this has caused you. 

Best wishes,
Serge
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Teleric
Top achievements
Rank 1
answered on 15 Sep 2013, 12:42 PM
Hi Joan Vilariño

I have two queries.

1. I am new in MVC 4.0. I want to use Teleric Grid in MVC 4.0. Can you please share any useful link to display data in Teleric grid?

2. Can you tell what is meant by Teleric Open Access? What does it means ?


Thanks
0
Kristian Nikolov
Telerik team
answered on 16 Sep 2013, 03:15 PM
Hello,

Telerik OpenAccess ORM is a Object Relational Mapper and as such it solves the object-relational impedance mismatch. Here you can read more about OpenAccess ORM and the advantages it gives you. Please find the answer to your MVC4 related questions in your thread.

Regards,
Kristian Nikolov
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.
Tags
Integration with other products
Asked by
Joan Vilariño
Top achievements
Rank 2
Answers by
Serge
Telerik team
Teleric
Top achievements
Rank 1
Kristian Nikolov
Telerik team
Share this question
or