how can i set label value within ASP.Net DataList using jquery

Posted by Abhijit.Barua under ASP.NET on 6/23/2012 | Points: 10 | Views : 3360 | Status : [Member] | Replies : 3
how can i set label value within ASP.Net DataList using jquery. plz help me.

thank you




Responses

Posted by: Sheonarayan on: 6/23/2012 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Have a specific class for the asp:Label (this class may not be declared in the CSS). Use jQuery CSS selector and specify its text.

Something like

$(".myClass").text("Something");


Hope this helps.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

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

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

Up
0
Down
thank you sir,

i was try like this...i got data at json & at general asp.net control it's bind also but in case of datalist(label within datalist) i not able to do it.

my code...
<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) {


$("[id*=Label3]").eq(0).text(item.Id);
$("[id*=Label4]").eq(1).text(item.name);
for (var i = 0; i < data.d.length; i++) {
//here set vale for label within datalist


};

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

plz help me.


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

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

Up
0
Down
sir, how i have to write the css class for label(or what i have to write) plz help me.

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

Login to post response