I use this code for razor syntax of U7 Grid Data Type,and also i use umbraco's version 7.1 in webmatrix
** razor example **
<div>
@foreach (var dog in CurrentPage.dogs)
{
<div>
<p>Name - @dog.name </p>
<p>Description - @Html.Raw(dog.description) </p>
@if (dog.image != "") {
IPublishedContent iconImg = Umbraco.TypedMedia(dog.image.ToString());
<img src="@iconImg.Url" />
}
@if (dog.trained == "True")
{
<p>This dog is traind.</p>
}
</div>
}
</div>
but i can't understand with this example what is currentpage.dogs here can you please help me or give me other example that how i use U7 Grid Data Type in my template page.Here my U7 Grid Data Type contain two column (image and description ).
I haven´t worked with U7 Grid Data Type, but CurrenPage is represents the page that you´re on in the content tree, and the CurrentPage.dogs, represents a property on the page with a alias of dogs.
The only thing that I can see right now is wrong is that you have a @ in front of Model.Content.GetProperty("emprepater") in the foreach loop, so try something like this.
Thanks for solution,with using your code i got this error.
foreach statement cannot operate on variables of type 'Umbraco.Core.Models.IPublishedProperty' because 'Umbraco.Core.Models.IPublishedProperty' does not contain a public definition for 'GetEnumerator'
Thanks for quick reply Dennis this time it's work for me.but there is one small problem is there.
Image is not displaying in website.Imagepath is wrong i think can you help me for this problem?
Need help for razor syntax in U7 Grid Data Type
I use this code for razor syntax of U7 Grid Data Type,and also i use umbraco's version 7.1 in webmatrix
but i can't understand with this example what is currentpage.dogs here can you please help me or give me other example that how i use U7 Grid Data Type in my template page.Here my U7 Grid Data Type contain two column (image and description ).
Thanks in advance.
Hi ketan,
I haven´t worked with U7 Grid Data Type, but CurrenPage is represents the page that you´re on in the content tree, and the CurrentPage.dogs, represents a property on the page with a alias of dogs.
The documentation for working with properties, can be found here: http://our.umbraco.org/wiki/how-tos/working-with-document-types
Documentation about what CurrentPage is in MVC can be found here: http://our.umbraco.org/documentation/Reference/Mvc/views#Renderingafieldusing@CurrentPage%28dynamically%29
Hope this can make your understanding more clear.
/Dennis
Thanks Dennis for solution i used with this code but i got error.
I mean when i am typing @Model then i press dot(.) then also fieldname(emprepater) which is created is not accessible.
Can you give some suggestion or tips here.
Hi ketan,
The only thing that I can see right now is wrong is that you have a @ in front of Model.Content.GetProperty("emprepater") in the foreach loop, so try something like this.
And your alias of the field that you want to get data from is named emprepater
Hope this helps,
/Dennis
Thanks for solution,with using your code i got this error.
foreach statement cannot operate on variables of type 'Umbraco.Core.Models.IPublishedProperty' because 'Umbraco.Core.Models.IPublishedProperty' does not contain a public definition for 'GetEnumerator'
Can you help me for this?
Hi ketan,
Okay I will try to see if I could help you help out.
How about something like this:
And your alias of the field that you want to get data from is named emprepater
Hope this helps,
/Dennis
Thanks for quick reply Dennis this time it's work for me.but there is one small problem is there. Image is not displaying in website.Imagepath is wrong i think can you help me for this problem?
Hi ketan,
I think that I spotted what you´re missing. You´re missing url where you are printed the image.
Try this:
Hope this helps,
/Dennis
Excellent Dennis This is completely work for me thanks for your support.I am really grateful of you.
You´re welcome
is working on a reply...