External refresh from another Partial Update panel using Javascript

Jan 20, 2010 at 4:01 PM

Dear Stefan,

I would like to update a partial panel from another partial update panel. It doesn't work because if I set via code the propery


LbContCorr.OnClientClick="refreshPanel();return false;" 

in the LinkButton, the PartialUpdatePanel render that as  

<input id="ctl00.ContentPlaceHolder1.RepeaterFaq.ctl00.PanelUpdCorrelati_LbContCorr" type="image" style="border-width: 0px;" onclick="setTimeout('$find(\'ctl00_ContentPlaceHolder1_RepeaterFaq_ctl00_PanelUpdCorrelati\').pb(\'ctl00.ContentPlaceHolder1.RepeaterFaq.ctl00.PanelUpdCorrelati$LbContCorr\',\'null\')',0);return false;" src="Graphics/contenuti.gif" name="ctl00.ContentPlaceHolder1.RepeaterFaq.ctl00.PanelUpdCorrelati$LbContCorr"/> 


and the old OnclientClick is ignore.

If I manual add the attribute 'OnClick'

LbContCorr.Attributes["onclick"] = "refreshPanel(); return false;";

it is render as

onclick="setTimeout('$find(\'ctl00_ContentPlaceHolder1_RepeaterFaq_ctl00_PanelUpdCorrelati\').pb(\'ctl00.ContentPlaceHolder1.RepeaterFaq.ctl00.PanelUpdCorrelati$LbContCorr\',\'null\')',0);return false;refreshPanel();return false;"

and so my javascript is override by setTimeout.

Is there any walkaround for my problem, or should I use a PostBack anche register a script?
Thanks a lot


Jan 21, 2010 at 9:39 AM

I use the OnClick properties of the LinkButton and in the handler I write

            string script = "refreshExternal('" + id + "');";
            ScriptManager.RegisterStartupScript(this, GetType(), "showCorrelati", script, true);
Thanks a lot