Click here to Skip to main content
15,909,373 members

Comments by Abhijit Barua (Top 8 by date)

Abhijit Barua 27-Jun-12 7:58am View    
i check all this link previously.
Abhijit Barua 27-Jun-12 7:58am View    
thank you...
gridview bind properly but i got problem at binding datalist.
Abhijit Barua 26-Jun-12 3:55am View    
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"></td></tr>
<tr><td> <asp:Label ID="Label4" runat="server"></td></tr>
</table>






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) {

var lable = document.getElementById("<%=Label3.ClientID %>");

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 25-Jun-12 3:55am View    
sir, how i have to write the css class for label(or what i have to write) plz help me.
Abhijit Barua 23-Jun-12 5:14am View    
Deleted
thank you sir,

i try like below. i have master page. i give code below plz help me.

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<style type="text/css">

.labelStyle
{
color:red;
background-color:yellow;
border:Solid 2px Red;
}
.labelStyle1
{
color:red;
background-color:yellow;
border:Solid 2px Red;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<%-- <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>--%>
<script type="text/javascript">
$(document).ready(function () {
$("#getData").click(function () {
// var table = $("#tableID").show();
// table.find("tr+tr").remove();
$.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++) {

$('.labelStyle').text(item.Id);
$('.labelStyle1').text(item.name);
};


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

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
Get data

<asp:DataList ID="DataList1" runat="server">
<itemtemplate>
<table><tr><td><asp:Label ID="Label3" runat="server" CssClass="labelStyle"></td></tr>
<tr><td> <asp:Label ID="Label4" runat="server" CssClass="labelStyle1"></td></tr>
</table>