我有一个radcombobox,它在aspx页面中同时包含回发和非回发项目。在其中一个非回发项目中,它会通过jQuery弹出一个模态对话框。对话框中的代码只能查找,但我必须单击操作按钮('保存')两次才能运行对话框的代码。这是由于具有焦点的radcombobox。有没有办法以编程方式从radcombobox中删除焦点,以便我只点击一次?我试过.blur()但它没有用。感谢。
function onClientSelectedIndexChanged(sender, eventArgs) {
var text = eventArgs.get_item().get_text();
var combo = $find("<%= rdbxActions.ClientID %>");
combo.set_text(text);
if (text == "Filter By Date" || text == "Filter By Publication") {
__doPostBack("rdbxActions", '{\"Command\" : \"Select\"}');
}
else {
combo.blur();
}
}
对话发生的地方......
function onClientSelectedIndexChanging(sender, eventArgs) {
var text = eventArgs.get_item().get_text();
var combo = $find("<%= rdbxActions.ClientID %>");
combo.set_text(text);
if (text != "Filter By Date" && text != "Filter By Publication") {
eventArgs.set_cancel(true);
if (text != "Actions") {
$("#dialog-save").dialog({
resizable: false,
height: 170,
modal: true,
buttons: {
"Save": function () {
var pageUrl = '<%=ResolveUrl("~/WebService/SaveNewSearch.asmx")%>'
var thisSearchName = $("#searchNameText").val();
//get current keyword string
//get the parameter value
$.urlParam = function (name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;
}
//put url into a variable
var thisKeywordString = decodeURIComponent($.urlParam('kws'));
var thisUser = userLoggedIn;
$.ajax({
type: "POST",
url: pageUrl + "/SaveThisNewSearch",
data: JSON.stringify({ searchName: thisSearchName, keywordString: thisKeywordString, userId: thisUser }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSaveSearchSuccess,
error: OnSaveSearchError
});
function OnSaveSearchSuccess(response) {
//.text(response.d);
//Show Saved Search Dialog
var searchNameString = response.d;
$("#dialog-modal p").text(searchNameString);
//show the dialog with the save message
$("#dialog-modal").dialog({
resizable: false,
height: 140,
hide: "fade",
open: function (event, ui) {
var dlg = $(this);
setTimeout(function () {
dlg.dialog("close");
}, 2000);
},
modal: true
});
}
function OnSaveSearchError(response) {
alert(response.status + " " + response.statusText);
}
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
}
}