We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MVC 3 + Grid Builder + Hierarchical Grid = ?

Thread ID:

Created:

Updated:

Platform:

Replies:

100070 Jun 30,2011 12:36 PM UTC Apr 9,2018 04:38 AM UTC ASP.NET MVC (Classic) 5
loading
Tags: Grid
Greg Clouston
Asked On June 30, 2011 12:36 PM UTC

I'm try to figure out how to add the hierarchical grid functionality to our project. The only example available build the grid in the view. Right now we configure the grid via the "GridPropertiesModel". The ".ChildGrid" in the view model seems to be expecting a string. That doesn't seem right to me.

Can you provide an example for us?


Ranjithkumar R G [Syncfusion]
Replied On July 7, 2011 10:11 AM UTC

Hi Greg,

Thanks for using Syncfusion products.

Sorry for the delay in getting back to you.

We suggest you to use Hierarchical grid using GridBuilder i.e. in Viewpage. Hierarchical Grid is mainly designed to use in Viewpage. In GridPropertyModel, the child grid which expects string and the grid is rendered through which is not recommended.

Please let us know if you have any concern.

Regards,
Ranjithkumar.



Greg Clouston
Replied On July 7, 2011 05:32 PM UTC

Ok, good to know.

My next question is how do I implement the child grid in a MVC 3 project using VB.Net?

I've attached a project containing my attempt to translate one of your examples. I can't seem to get it to work. Can you perhaps shed some light on what I'm doing wrong?



Hierarchical Grid 01_714c4b59.zip

Ranjithkumar R G [Syncfusion]
Replied On July 13, 2011 11:01 AM UTC

Hi Greg,

Thanks for using Syncfusion products.

we suggest you to map the child grid using key value with the ColumnName. Then, we suggest you to add the child grid as template with the parent grid. Please refer to the code-snippets below.

[ASPX]



//adding childgrid

Dim gridChildBuilder = Html.Syncfusion().Grid(Of MvcApplication2.Order_Detail)("ChildGridAction_${OrderID}")

'add grid columns using gridChildBuilder
gridChildBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication2.Order_Detail) c.ProductID).HeaderText("ProductID"))
gridChildBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication2.Order_Detail) c.OrderID).HeaderText("OrderID"))
gridChildBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication2.Order_Detail) c.UnitPrice).HeaderText("UnitPrice"))
gridChildBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication2.Order_Detail) c.Quantity).HeaderText("Quantity"))
gridChildBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication2.Order_Detail) c.Discount).HeaderText("Discount"))

gridChildBuilder.EnablePaging()
gridChildBuilder.EnableGrouping()
gridChildBuilder.EnableSorting()
gridChildBuilder.Mappers(Function(map) _
map.Action("ChildGridAction", New With { _
Key .OrderID = "${OrderID}" _
}))

Dim template = gridChildBuilder.ToChildGridTemplate()





//adding child grid as a template



gridbuilder.ChildGrid(Function(ChildGrid)

ChildGrid.ChildGridTemplate(template)

End Function _
)




[CodeBehind-CS]



_
Function ChildGridAction(ByVal args As PagingParams, ByVal OrderID As Integer) As ActionResult

Dim data As IEnumerable = New NorthwindDataContext().Order_Details.Where(Function(c) c.OrderID = OrderID).ToList()
Dim engine = TryCast(data.GridActions(Of Order_Detail)(), GridHtmlActionResult(Of Order_Detail))

Return engine
End Function



Please refer to the below link to download the modified sample.

Razor sample:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=MvcApplication2-620874601.zip


ASPX sample:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Grouping-1222922153.zip



Please let me know if you have any queries.

Regards,
Ranjithkumar.



arif
Replied On April 9, 2018 02:35 AM UTC

Thanks, For informations and books.

Isuriya Rajan [Syncfusion]
Replied On April 9, 2018 04:38 AM UTC

Hi Greg, 

Thanks for the update, 

please let us know whether u need any other assistance 


Regards, 
Isuriya R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;