how can i set asp.net datalist itemtemplate label value with json data

Posted by Abhijit.Barua under ASP.NET on 6/26/2012 | Points: 10 | Views : 1717 | Status : [Member] | Replies : 2
how can i set asp.net datalist itemtemplate label value with json data




Responses

Posted by: Muralidosscm on: 6/26/2012 [Member] Starter | Points: 25

Up
0
Down
say clearly?




Regards
Muralidoss M

Abhijit.Barua, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhijit.Barua on: 6/26/2012 [Member] Starter | Points: 25

Up
0
Down
thank you,

i have datalist with itemtemplate have label like below...
<asp:DataList ID="DataList1" runat="server">

<ItemTemplate>
<table><tr><td><asp:Label ID="Label3" runat="server"></asp:Label></td></tr>
<tr><td> <asp:Label ID="Label4" runat="server"></asp:Label></td></tr>
</table>

<hr />
</ItemTemplate>
</asp:DataList>

i use webservice to send data to json....i got data at json...and i use jquery to bind datalist like below...
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function () {
$("#getData").click(function () {

$.ajax({
url: "WebService.asmx/GetStudents",
data: "{}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
$(data.d).each(function (index, item) {


for (var i = 0; i < data.d.length; i++) {

//here what i have to write.........
};


});
},
error: function (a, b, c) {
}
});
});
});
</script>

but i not able to bind datalist. plz help me....

Abhijit.Barua, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response