2
Reply

linkbutton is not working on second click ?

Aniruddh Kewat

Aniruddh Kewat

Jun 19 2015 4:12 AM
388
i have a datalist which gets populated depending on the selection through,link button and radio buttons...
..the link button passes the categoryid parameter,radio button-rblbrands passes the brand parameter 
and last radio button-rblpricerange passes the price parameter....
 
when the page loads,and i scroll selecting any thing,the scroll works fine...but when i click any link button
 second time,the categoryid,PageIndex and the PageCount   doesn't changes,it holds the value of 
previos selection ..
 
var pageIndex = 1;
var pageCount;
var categoryid = 0;
var brandtext = null;
var pricevalue = 0;
$(document).ready(function () {
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
$('.clbtnmenu').click(function () {
categoryid = $(this).data('id');
pageIndex = 1;
});
});
function GetRecords() {
pageIndex++;
/*retrieving Text from rblbrands if checked*/
if ($('#<%=rblbrands.ClientID %> input:checked').val() != null) {
var checked_radiobrands = $("[id*=rblbrands] input:checked");
//brandsvalue = checked_radiobrands.val();
brandtext = checked_radiobrands.closest("td").find("label").html();
}
if ($('#<%=rblpricerange.ClientID %> input:checked').val() != null) {
var checked_radioprice = $("[id*=rblpricerange] input:checked");
pricevalue = checked_radioprice.val();
//pricetext = checked_radioprice.closest("td").find("label").html();
}
alert('PageIndex : ' + pageIndex + ' , Page Count : ' + pageCount + ' , CategoryId : ' + categoryid + " , BrandText : " + brandtext + " , PriceValue :" + pricevalue);
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "WebForm1.aspx/GetCustomers",
data: JSON.stringify({ 'pageindex': pageIndex, 'categoryid': categoryid, 'brand': brandtext, 'price': pricevalue }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert('Hell 1');
},
error: function (response) {
alert('Hell 2');
}
});
}
}
 

Answers (2)