Was wondering if anyone colud help me with this problem, I reckon I must be close to a solution, but here goes - I have set up a new Data Type using the uComponent: DataType Grid. Which looks like this:
This gives me the table names but none of the information inside the cells, I reckon I am doing something stupid and cant see it. Anyone else know what the problem could be?
I am kind of assuming that you are using the same version of Umbraco as you have when you used this prefiously, and that this was not working.
As I looked at it, the property names have lowercase first letters, I think they should be capital letters, ie not @cell.menu, but @cell.Menu. I checked via the link you posted and capital letters are used there, so think it should be the same.
I have not used data-type grid, but read you post to try to see if I could learn something.
Hey guys, thanks for your help, but the capatalisation didnt work! @Rich - Umbraco.config would only show me errors would it not, there arent any errors for the script it just doesnt seem to be showing.
@Gary - tried with the capitals and nothing seemed to change.
@Francisco - there is data there I have two rows of data:
This didnt seem to work, it must be something small just cant seem to get it!
Try hitting save and publish again on your docType then save and publish again, this may be Version specific, but I have had this before, when clearly it does exist but is not being recognized.
Had uComponents 3.2 - I think. Tried uninstalling and putting v5.4.0 and now got another error within Umbraco. Deleted the Datatype and readded a new one and cant open the page in Umbraco now.
<h3>List all rows and cells</h3>
<table cellspacing="0" cellpadding="0">
<tr>
<th>Menu</th>
<th>Price</th>
<th>Description</th>
</tr>
@foreach(var row in Model.test)
{
<tr>
<td>@row.menu</td>
@*<td>@row.Price</td>
<td>@row.Desc</td> *@
</tr>
}
</table>
I've got it pumping out 'umbraco.MacroEngines.DynamicXml' how do I then get the Value of this. tried @row.menu.Value. Not sure of the correct syntax. Any ideas?
The "foreach" gets a wavy line in VS2012 saying "foreach statement cannot operate on vairables of type 'Umbraco.Core.Models.IPublishedContentProperty' because it does not contain a public definition for 'GetEnumerator'.
I am totaly new in Umbraco, and I have the fix requirement to work with ucomponents DataType Grid. That was I did good, but now I struck up when I am going to retrived data from the cell (i.e. textstring) through javascript.. Please help me to get out of that.. I do not want to use Razor ..
uComponents Data Type Grid - Razor Syntax
Hey,
Was wondering if anyone colud help me with this problem, I reckon I must be close to a solution, but here goes - I have set up a new Data Type using the uComponent: DataType Grid. Which looks like this:
I've then put this on to a page and put in some dummy code, I've then used the razor code from the blog post: http://ucomponents.org/data-types/datatype-grid/razor-samples/
So my Razor code looks like:
This gives me the table names but none of the information inside the cells, I reckon I am doing something stupid and cant see it.
Anyone else know what the problem could be?
Thanks in advance.
Jason
Hey Jason,
Does looking at the /App_Data/umbraco.config help?
Rich
Hi Jason
Could it be
That would be normal in Umbraco and does seem to be the same from the link you posted.
Other than that, have no idea: G
Have you filled your grid with some data?
I have been using DataType-grid here quite a lot, and it works fine.
Hi Francisco
I am kind of assuming that you are using the same version of Umbraco as you have when you used this prefiously, and that this was not working.
As I looked at it, the property names have lowercase first letters, I think they should be capital letters, ie not @cell.menu, but @cell.Menu. I checked via the link you posted and capital letters are used there, so think it should be the same.
I have not used data-type grid, but read you post to try to see if I could learn something.
Hey guys, thanks for your help, but the capatalisation didnt work!
@Rich - Umbraco.config would only show me errors would it not, there arent any errors for the script it just doesnt seem to be showing.
@Gary - tried with the capitals and nothing seemed to change.
@Francisco - there is data there I have two rows of data:
This didnt seem to work, it must be something small just cant seem to get it!
Hey Jason,
It might have be quicker to look at the umbraco.config file :)
Rich
Hey Rich,
My XML for this looks like:
Do you see anything that could be wrong with this?
Hey Jason,
What version of Data Type grid are you using?
Rich
Right think I might be a step closer.
Instead of @Model.DataTypeGrid - I have called mine 'Test' so I have placed in @Model.test. This then throws me up the error :
Error loading Razor Script Menu.cshtml
'umbraco.MacroEngines.DynamicXml' does not contain a definition for 'menu'
I have tried Menu and menu but still nothing, anyone else got a thought about this?
Hi Jason
Try hitting save and publish again on your docType then save and publish again, this may be Version specific, but I have had this before, when clearly it does exist but is not being recognized.
G
Had uComponents 3.2 - I think. Tried uninstalling and putting v5.4.0 and now got another error within Umbraco. Deleted the Datatype and readded a new one and cant open the page in Umbraco now.
Completely lost now!
Not sure where you are with this, but when I pulled out data I did it along the lines of this:
Actually looking at your code, if you replace with @cell.Value you should get the value of each property out (and cell.Alias to get the alias etc).
But I'm guessing if you want a table of all the results you need something like this?
Mr Rogers,
I am almost there using :
I've got it pumping out 'umbraco.MacroEngines.DynamicXml' how do I then get the Value of this. tried @row.menu.Value. Not sure of the correct syntax. Any ideas?
Ah you want to be looking at the "up until 5.4.0" version of the code and use
@row.menu.InnerText
You sir are a beautiful beautiful man!
Works a treat.
Yeah had to revert back to using one before 5.4.0 as it buggered up and I couldnt be bothered messing around with Dll's!
Thanks for everyones help - the final code I needed (if this helps anyone) is:
Similar problem but in an MVC site Umb V6.1.1 uComp V5.4. Can't get the syntax to access uComponents DataTypeGrid.
The "foreach" gets a wavy line in VS2012 saying "foreach statement cannot operate on vairables of type 'Umbraco.Core.Models.IPublishedContentProperty' because it does not contain a public definition for 'GetEnumerator'.
How do you get the data out in Razor?
Any help would be appreciated.
Cheers,
Craig
Hello Friends,
I am totaly new in Umbraco, and I have the fix requirement to work with ucomponents DataType Grid. That was I did good, but now I struck up when I am going to retrived data from the cell (i.e. textstring) through javascript.. Please help me to get out of that.. I do not want to use Razor ..
Thanks.
is working on a reply...