Tanlangan bir nechta qutidagi qiymatlarni saqlash

Yo'qolgan joydan ko'chiriladigan B qiymatlari o'zgargan taqdirda ma'lumotlar bazasidan boshqa bir nechta tanlovli B qutisiga joylashtirilgan bir nechta A qutisidan o'tish uchun pastda JavaScript funksiyasi mavjud. Dastlab men server tomonidagi harakatlar uchun "runat =" server "tagini kiritganim uchun o'ylab qoldim, lekin, ehtimol, bunday emas. Form.Request haqida o'qib chiqdim, ammo qanday qilib bu haqda borish kerakligini bilishmaydi. Men bu qiymatlarni bir nechta tanlangan qutidagi B saqlayman. Iltimos, iltimos, mulohaza qiling. Rahmat.

<%-- Move items to and fro select box --%>

function move(sourceFrom, sourceTo) {
    var arrFrom = new Array();
    var arrTo = new Array();
    var arrLU = new Array();
    var i;
    for (i = 0; i < sourceTo.options.length; i++) {
        arrLU[sourceTo.options[i].text] = sourceTo.options[i].value;
        arrTo[i] = sourceTo.options[i].text;
    }
    var fLength = 0;
    var tLength = arrTo.length;
    for (i = 0; i < sourceFrom.options.length; i++) {
        arrLU[sourceFrom.options[i].text] = sourceFrom.options[i].value;
        if (sourceFrom.options[i].selected && sourceFrom.options[i].value != "") {
            arrTo[tLength] = sourceFrom.options[i].text;
            tLength++;
        } else {
            arrFrom[fLength] = sourceFrom.options[i].text;
            fLength++;
        }
    }

    sourceFrom.length = 0;
    sourceTo.length = 0;

    var ii;
    for (ii = 0; ii < arrFrom.length; ii++) {
        var no = new Option();
        no.value = arrLU[arrFrom[ii]];
        no.text = arrFrom[ii];
        sourceFrom[ii] = no;
    }

    for (ii = 0; ii < arrTo.length; ii++) {
        var no = new Option();
        no.value = arrLU[arrTo[ii]];
        no.text = arrTo[ii];
        sourceTo[ii] = no;
    }

    (sourceTo).focus();

    if (sourceTo == (document.getElementById('<%= outletFromBox.ClientID%>'))) {
        (sourceFrom).focus();
    }
    if (sourceTo == (document.getElementById('<%= QualMemTypeFromBox.ClientID %>'))) {
        (sourceFrom).focus();
    }
    if (sourceTo == (document.getElementById('MemStatusFromBox'))) {
        (sourceFrom).focus();
    }
}  

0

1 javoblar

Agar ListBox-ga mijozlardagi o'zgarishlar server tomonida saqlanmasa, PostBack paydo bo'lganda o'zgarish yo'qoladi; bu linkni qanday tekshirishingiz mumkinligini tekshiring:

http : //www.vijaykodali.com/Blog/post/2007/12/14/Add-Delete-Items-in-DropDownList2c-ListBox-using-Javascript.aspx

Agar siz ushbu echim bilan ishlashda muammoga duch kelsangiz, menga xabar bering va aspx kodini yozing ... biz sizning aniq ishingiz uchun hal qilishimiz mumkin.

0
qo'shib qo'ydi
Javascript UZB
Javascript UZB
99 ishtirokchilar

@js_uzb @vuejs_uz @react_uz @nodejs_uz @angular_uz @ngTashkent @yiiframework_uz @laravel_uz @linux_uzbek @python_uz @swift_uzb —————— @uzdevgroup @UzGeeksGroup ——— @UzDev_Jobs @jobs_uzb