отображение данных из файла .json в табличную форму в ASP.NET страница
I've to show the data in a table importing the data from a JSON file. I can not proceed further with this. Since I am new to asp.net, do not how to display the imported data in a table in ASP.NET.
//// json file {"employees":[ {"firstName":"Anna","lastName":"Meyers"}, {"firstName":"Betty","lastName":"Layers"}, {"firstName":"Carl","lastName":"Louis"}, ]}
<%@ Page Title="About" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="About.aspx.cs" Inherits="ReadDataJSON.About" %> <asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <script type="text/javascript" src="jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#Result").click(function() { $.ajax({ type: "GET", url: "C:\Users\NISCHALINN\Documents\test.json", beforeSend: function() { $.blockUI({ fadeIn : 0, fadeOut : 0, showOverlay : false }); }, dataType: "json", success: function(data) { alert(data); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("Request: " + XMLHttpRequest.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown); }, complete: function () { $.unblockUI(); } }); }); }); </script> <h2><%: Title %>.</h2> <h3>Your application description page.</h3> <h4>JSON Object Creation in JavaScript</h4> <p>Use this area to provide additional information.</p> <div> <% ------- display the JSON data in tabular format ------ %> </div> </asp:Content>
Выходной формат таков:
FirstName LastName ------------------ Anna Meyers Betty Layers Carl Louis ------------------
Как я могу это сделать? Пожалуйста помогите мне я новичок в этом деле ASP.NET.
С уважением!