Search code examples
c#asp.netasp.net-mvcparse-platformparse-dotnet-sdk

How can I render custom field values from a ParseObject in cshtml using ASP.NET Razor Pages?


I'm using Razor Pages with ASP.NET to render data to my cshtml:

@* Iterate over Yeet collection *@
@foreach (var yeet in Model.YeetsList)
{
    <p>@yeet.Keys.1.value</p><br />
}

I'm iterating over a List called YeetsList that contains some ParseObject objects.

ParseObjects don't have the custom field accessors one would need to render anything more than basic ParseObject data such as ObjectId, CreatedAt, UpdatedAt, etc., but I figured I could just render these (private) fields anyway by printing the value of the Key I want according to this:

enter image description here

I get the following:

enter image description here

What I want is the actual value of "notificationText". How can I retrieve this and render it without going through the hassle of creating a local data model? I really don't want to create a proper app at the moment. I just want to print the value of "notificationText" that is contained in the object.


Solution

  • You can use something like this , this might help

       @foreach (var yeet in Model.YeetsList)
        {
           @foreach (string key in yeet.Keys)
            {
               <p>@yeet[key].value</p><br />
            }    
        }