0

Ok, so I have a repeater which renders among other things a literal control which contains a string of JSON data. this data is lifted from a database and is set up as follows:

public void GetResults(string messageId)
{
    var messages = MtFacade.GetResults(messageId).AsQueryable();
    rptResults.DataSource = messages;
    rptResults.DataBind();
}

MtFacade.GetResults return a list of the following class:

public class Results
{
    public string SearchedString { get; set; }
    public string MatchedString { get; set; }
    public string Result { get; set; }
} 

the field in question is the Result string. How would one render this JSON string in a repeater?

* EDIT * Aim is to make the JSON data more readable to the naked eye.

Repeater is:

<asp:Repeater runat="server" ID="rptDuplicates" ItemType="Models.DuplicateMessages" >
     <ItemTemplate>
         <div class="message">
             <p><strong>Message:&nbsp;</strong><asp:Literal ID="ltMessage" runat="server" Text='<%# Item.Message %>'></asp:Literal></p>                               
             <p><strong>Message Id:&nbsp;</strong><asp:Literal ID="ltMessageId" runat="server" Text='<%# Item.MessageId %>'></asp:Literal>
             <p><strong>Matching Message Id:&nbsp;</strong><asp:Literal ID="ltMatchingMessageId" runat="server" Text='<%# Item.MatchingMessageId %>'></asp:Literal></p>                \
         </div>
     </ItemTemplate>
</asp:Repeater>
Christos
  • 53,228
  • 8
  • 76
  • 108
CSharpNewBee
  • 1,951
  • 6
  • 28
  • 64
  • Just like any other string. What is the problem you have with your current code / repeater output? Can you include relevant repeater code? Do you mean you have formatting/layout problems with the string? – MikeSmithDev Feb 19 '14 at 16:06
  • It may be helpful to explain what your ultimate goal is. – Spencer Ruport Feb 19 '14 at 16:10
  • Hi MikeSmithDev - the string is rendered correctly, it's as you state, its the formatting, i was looking for something like you see at jsonlint.com/ – CSharpNewBee Feb 19 '14 at 16:13

0 Answers0