당신은 같은 뭔가 항목의 클라이언트 측을 이동할 수 있습니다
$("#btnMoveSectionUp").click(function (e) {
var curr = $("#<%= lstEditReportSections.ClientID %> option:selected");
if (curr.length == 0) return;
if (curr.index() > 0) {
var prev = curr.prev();
curr.insertBefore(prev);
}
});
$("#btnMoveSectionDown").click(function (e) {
var curr = $("#<%= lstEditReportSections.ClientID %> option:selected");
if (curr.length == 0) return;
if (curr.index() < $("#<%= lstEditReportSections.ClientID %> option").length - 1) {
var next = curr.next();
curr.insertAfter(next);
}
});
그러나 서버는 클라이언트에 변경 사항이 표시되지 않습니다. 내가 한 것은이 코드를 사용하여 숨겨진 필드에 모든 값을 저장 한 다음 서버 측에서 분할하는 것입니다.
$("#<%= btnSaveReport.ClientID %>").click(function (e) {
if (confirm("Are you sure you want to save the report?") != true) return false;
var sections = $("#<%= lstEditReportSections.ClientID %> option").map(function() {
return $(this).val();
}).get().join('#');
$("#<%= hidEditReportSectionsList.ClientID %>").val(sections);
});
그것은 이상적이지는 않지만 저를위한 속임수였습니다.
데이터베이스 테이블에 주문 열이 있습니다. 목록 상자 또는 다른 컨트롤을 계속 진행하는 것이 좋은지 여부를 알아야합니까? 목록 상자와 함께 사용하면 jquery로 위아래로 이동할 수 있습니다. – Prasad