Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Im trying to update a list in updatepanel when clicking in another list. my solution is prolly not the nicest but it kinda works. what I noticed is my ".click" gets called multiple times, one extra time every time I click the list. So the alert first pops 1time, then 2, 3 and so on. As I was looking for a solution I saw something about Sys.WebForms.PageRequestManager.getInstance().remove_pageLoaded(yourAutoCompleteInitializationFunction);

I wasnt sure where to put it so that is prolly wrong. Anyway, after adding that line my alert only gets called one time, every time(yay)...but my list never gets updated by button.click() :(

Does anyone know what im doing wrong here?...heres my code:

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(yourAutoCompleteInitializationFunction);

function yourAutoCompleteInitializationFunction() {

var docfilterbox = document.getElementById("ctl00_m_g_1e1946ec_c6f1_4dcf_81fb_2c0af025b616_docFilterBox");
var button = document.getElementById("ctl00_m_g_1e1946ec_c6f1_4dcf_81fb_2c0af025b616_docfilterButton");
var uploaddoc = document.getElementById("ctl00_m_g_1e1946ec_c6f1_4dcf_81fb_2c0af025b616_uploaddoc");

$("tr").click(function () {

    if ($(this).closest('table').attr('summary') == "KundLista") {

        alert("this get called multiple times without Sys.WebForms.PageRequestManager.getInstance().remove_pageLoaded(yourAutoCompleteInitializationFunction);");

        var kundid = $(this).children(".ms-vb-title").text();

        kundid = kundid.substring(0, kundid.length - 2)

        docfilterbox.value = kundid;

        button.click();

        //this calls the alert ONE time but my list never gets updated by: button.click();
        Sys.WebForms.PageRequestManager.getInstance().remove_pageLoaded(yourAutoCompleteInitializationFunction);
    }
});

}

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.