In the code for the ASP.NET project (MVP template), I get a line in one of the presenters that contains something similar to the contents of the JSON file.
Then I set one of the properties of the view that is assigned to the presenter - with this line.
In the view, the line is displayed in the TextBox, but it does not look very good, because it is not structured with new lines and lines. I know that there is a JSON function called Stringify that can make such strings beautiful.
Can this function be called JSON in code? For example, when do I set the presentation property in the presenter?
So, I installed it in the presenter:
this.view.ContentAsJson = GetContentAsJson(uuid);
This is what I would like to do if possible:
this.view.ContentAsJson = JSON.Stringify(GetContentAsJson(uuid));
GetContentAsJson is a function that creates and returns a JSON string.
This is my opinion:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ContentJsonView.ascx.cs" Inherits="WebCenter.PP.PI.WebGui.View.FolderView.ContentJsonView" %> <%@ Import Namespace="WebCenter.PP.Common.Domain" %> <div id="DivContentJson" class="clearfix"> <p> <asp:TextBox runat="server" ID="TbContentJson" TextMode="MultiLine" Height="100%" Width="100%" /> </p> </div>
This property is in the view that receives the string:
public string ContentAsJson { set { if (!string.IsNullOrEmpty(value)) { TbContentJson.Text = value; } else { TbContentJson.Text = ""; } } }
source share