c# - unable to populate data of table inside ContentPlaceHolder in aspx page -
i trying populate data of table inside contentplaceholder, not populating. earlier tried same code in aspx page body tag , populating there.here cant place body tag in contentplaceholder.here sending request web api data , getting data in json format. not sure,but feel going bad contentplaceholder.
<%@ page title="" language="c#" masterpagefile="~/rlcs_connect/tlconnect_new.master" autoeventwireup="true" codebehind="shownooflocations.aspx.cs" inherits="tlconnect_staffing.rlcs_connect.shownooflocations" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server"> <div> <h2><b>location table:</b></h2> <table id="location" cellpadding="3" cellspacing="3" border="2" width="600px"> <tr> <td style="background-color: gray; color: white">cl_stateid</td> <td style="background-color: gray; color: white">sm_name</td> <td style="background-color: gray; color: white">cl_cityid</td> <td style="background-color: gray; color:white">lm_name</td> <td style="background-color: gray; color:white">cl_branchname</td> <td style="background-color: gray; color:white">cl_branchaddress</td> <td style="background-color: gray; color:white">cl_officetype</td> <td style="background-color: gray; color:white">cl_establishmenttype</td> </tr> </table> </div> <asp:hiddenfield id="hfclientid" runat="server" /> <script src="scripts/jquery-3.1.1.min.js"></script> <script type="text/javascript"> var uri = 'http://localhost:62983/api/clientdetail/nooflocations'; $(document).ready(function () { var id = $('#hfclientid').val(); $.getjson(uri + '/' + id) .done(function (data) { $.each(data, function (key, item) { $('#location').append("<tr><td>" + item.cl_stateid + "</td>" + "<td>" + item.sm_name + "</td>" + "<td>" + item.cl_cityid + "</td>" + "<td>" + item.lm_name + "</td>" + "<td>" + item.cl_branchname + "<td>" + item.cl_branchaddress + "<td>" + item.cl_officetype + "</td>" + "<td>" + item.cl_establishmenttype + "</td></tr>"); }); }); }); </script> </asp:content> <asp:content id="content3" contentplaceholderid="contentplaceholder2" runat="server"> </asp:content>
Comments
Post a Comment