[英]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:我正在使用带有 ASP.NET 的 Razor Pages 将数据呈现到我的 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.我正在迭代一个名为 YeetsList 的列表,其中包含一些 ParseObject 对象。
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: ParseObjects 没有自定义字段访问器,除了基本的 ParseObject 数据(例如 ObjectId、CreatedAt、UpdatedAt 等)之外,我还需要呈现任何内容,但我认为无论如何我都可以通过打印我想要的关键是:
I get the following:我得到以下信息:
What I want is the actual value of "notificationText".我想要的是“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.
我只想打印对象中包含的“notificationText”的值。
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 />
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.