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

razor with treeview issues

0 Answers 71 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
georges
Top achievements
Rank 1
georges asked on 16 Dec 2010, 05:41 PM
i am trying to load the treeview as a parent a child using razor and here is my example and i am getting an error on the page that i cannot solve. here it is

@

 

using Telerik.Web.Mvc.UI;

 

@model

 

IEnumerable<TPRO.Models.GroupsModels>

 

@model

 

IEnumerable<TPRO.Models.SubGroupsModels>

 

@{

View.Title =

 

"Home Page";

 

}

 

<

 

 

table width="100%" cellpadding="0" border="0" cellspacing="0">

 

 

 

 

<tr valign="top" align="left"><td style="background:#FFF8C6">

 

@(

Html.Telerik().TreeView()

.Name(

 

"TreeView")

 

.Effects(fx =>

{

 

 

if (ViewData["animation"].ToString() == "slide")

 

{

fx.Slide();

}

 

 

else if (ViewData["animation"].ToString() == "expand")

 

{

fx.Expand();

}

 

 

else

 

{

 

 

/* activate only toggle, so that the items show */

 

fx.Toggle();

}

 

 

if ((bool)ViewData["enableOpacityAnimation"])

 

fx.Opacity();

fx.OpenDuration((

 

int)ViewData["openDuration"])

 

.CloseDuration((

 

int)ViewData["closeDuration"]);

 

})

.BindTo(Model, mappings =>

{

mappings.For<GroupsModels>(binding => binding

.ItemDataBound((item, groupModel) =>

{

item.Text = groupModel.Group;

})

.Children(groupModel => groupModel.rID));

mappings.For<SubGroupsModels>(binding => binding

.ItemDataBound((item, SubGroupModel) =>

{

item.Text = SubGroupModel.SubGroup;

}));

})

)

 

 

</td><td align="right" style="width:300px"><img alt="" src="../../images/logo.jpg" /></td></tr>

 

 

 

<tr style="background:#000000"><td align="center" colspan="2"><h2 style="color:White">Welcome to GDOT Transportation Projects</h2></td></tr>

 

</

 

 

table>

 

 

it is telling me that both models are not recognizable and if i do make the changes

Only one 'model' statement is allowed in a file.

do you have an example please with razor page with a treeview that loads parent and a child? thanks
Tags
TreeView
Asked by
georges
Top achievements
Rank 1
Share this question
or