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

MVC3 GRID + ORM STORED PROCEDURE + MySQL

3 Answers 46 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sander
Top achievements
Rank 1
Sander asked on 31 Jul 2011, 10:02 AM
hi Folks,

I am new to MVC and i have a MVC 3 Telerik project and try to display a grid with a Telerik ORM Stored Procedure call to MySQL.

My problem is:
that the GetDetailsChannel is of type Object[] and not a model, sdo how do i bind this object to my Grid or how do make my ORM Stored Procedure of type Model?

My Controler is:
        public ActionResult Channels()
        {
            var Channels = new IMS_ORM_Telerik.EntitiesModel();
            return View(Channels.GetDetailsChannel(1));
        }

My View is:
@model IEnumerable<IMS_ORM_Telerik.Channel>
  @(Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
     columns.Bound(o => o.Channel_id).Title("Id").Width(50);
     columns.Template(
                @<text>                    
                    <img src="/images/@item.Channel_image"/>           
                </text>)
                .Title("Icon").Width(50);
    columns.Bound(o => o.Channel_type);

    columns.Template(
        
  @<text>
  @Html.ActionLink("Edit", "Prepare/Television", new { item.Channel_id })
     @Html.ActionLink("Delete", "Prepare/Television", new { item.Channel_id })
               
                </text>).Title("Actions").Width(100);




    columns.Bound(o => o.Channel_type).Visible(false)



                  .FooterTemplate(@<text>Total Count: @item.Count</text>)
                  .GroupFooterTemplate(@<text>Count: @item.Count</text>);
})
.Sortable()
.Filterable()
.Pageable()
.Groupable())

Hope anyone can help me.

Thanks Sander

3 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 03 Aug 2011, 03:38 PM
Hi Sander,

 You can use our newly introduced ADO.API. With that api you are able to materialize not only to persistent types but to POCOs as well. Please have a look in our documentation for more information.
Please do not hesitate to contact us back should you have any further questions or problems.

Kind regards,
Petar
the Telerik team
Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 
0
Sander
Top achievements
Rank 1
answered on 03 Aug 2011, 06:58 PM
Thanks for your answer I tried your solution and it works the only thing is that is display all the columns it gives back and i just want to show a few of them, i set the autogeneratecolumns to false.

Thanks

Sander
0
Ivailo
Telerik team
answered on 05 Aug 2011, 02:42 PM
Hi Sander,

You should still be able to achieve that by defining column templates in the View, as you were doing in the sample code you have sent initially. There is detailed information for binding columns in the ASP.NET MVC grid documentation.

If you have problems configuring those templates, you can send the view and the controller and we can try to limit the columns for you as an example.

I am looking forward to your feedback.


All the best,
Ivailo
the Telerik team
Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 
Tags
Data Access Free Edition
Asked by
Sander
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Sander
Top achievements
Rank 1
Ivailo
Telerik team
Share this question
or