OpenAccess and MVC Telerik Grid

5 posts, 0 answers
  1. Joan Vilariño
    Joan Vilariño avatar
    116 posts
    Member since:
    Mar 2010

    Posted 24 Feb 2011 Link to this post

    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>
  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 02 Mar 2011 Link to this post

    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!
  3. DevCraft banner
  4. Serge
    Admin
    Serge avatar
    375 posts

    Posted 02 Mar 2011 Link to this post

    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!
  5. Teleric
    Teleric avatar
    4 posts
    Member since:
    Apr 2012

    Posted 15 Sep 2013 Link to this post

    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
  6. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 16 Sep 2013 Link to this post

    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.
Back to Top
DevCraft banner