ドロップダウンリストから次の関数に値を取得していますが、値がNullでない場合は機能します。私は次の関数にこの値を渡したいと思います。関数間で値を渡すjQuery AjaxとNULLを置換する
したがって、この機能では、私は、静的な値「ASC」とnull値を置き換えるんか2部
function getdropdownlistSelectedItem(sender, args) {
var raddropdownlist = $find('<%=RadDropDownList1.ClientID %>');
var selecteditem = raddropdownlist.get_selectedItem().get_value();
alert(selecteditem);
}
は、その後、私は、この関数で次のvar SORTBYに
ののSelectedItemの値を渡しますうまくいけば、誰かが私
のためにこれを修正することができVAR SORTBY = getdropdownlistSelectedItem() function GetRecords() {
var sortby = getdropdownlistSelectedItem();
alert('Sortby: ' + sortby);
pageIndex++;
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "categorypage.aspx/GetCustomers",
data: '{pageIndex: ' + pageIndex + ', sortby: ' + sortby + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
}
}
をしようとしていました
null値はどれですか? – JLRishe
最初のページロードでは、ドロップダウンリストの値はnullです。すなわちそれが選択されていない場合に実行される。 selecteditemの値がnullで、デフォルトのascと置き換える必要があります。 – jasonkkt