PDA

View Full Version : ASP.NET UpdatePanel and yui-ext not cooperating



brian.moeskau
28 Nov 2006, 11:47 AM
Anyone else trying to use a combination of yui-ext and ASP.NET UpdatePanels? For some reason, if I have yui-ext script elements wrapped within an UpdatePanel, after the UpdatePanel does an async postback, all my client scripts inside it become unresponsive until I reload the page. I'm new to using the UpdatePanels, so maybe there's a trick to getting them to better cooperate with other scripts?

agarcia
30 Nov 2006, 2:49 PM
Same problem here...if someone could help that would be greatly appreciated...

tryanDLS
30 Nov 2006, 2:54 PM
This may be an issue of the games that ASP.Net plays with the form ID. This has been discussed before with the workaround.

jack.slocum
30 Nov 2006, 3:06 PM
It could also be the ASP.Net rerenders the entire innerHTML of the UpdatePanel on postback, wiping out any event handlers or attached nodes.

brian.moeskau
30 Nov 2006, 7:51 PM
Yeah, it's definitely not the form id issue -- that had to do with rendering Jack's layout stuff correctly. This issue is in postbacks killing other scripts. It is not a yui-ext issue, just thought others might have some idea. I think Jack is in the right ballpark. The UpdatePanels do re-render the entire inner html within the UpdatePanel tags, and I think somehow I'm getting duplicate ids back for the elements that my scripts are keying off of. Not sure why, and I am sure that it's a .NET issue, but again I thought there might be someone else on the forum dealing with .NET who's figured out how to work successfully with these controls.

My preference would be to not use them at all and go the true Ajax/Json route, but I'm trying to work out a solution that other (non-js-savvy) .NET developers on the team can use more easily. So far it doesn't seem to be working out too well :(

vainternet
30 Jan 2008, 12:21 AM
We've achieved partial success in this by only wrapping exactly the part u want to update, and this is only with the Drag and Drop YUI.

IE if you have a databound UL, put the updatepanel inside the ul and update the li only, so long as the parent control is not renamed on postback, or there are still instances to work with within, it seems to work ok.

<ul id="ul2" class="draglist">

<asp:UpdatePanel runat="server" UpdateMode="Always">
<contentTemplate>

<asp:Repeater runat="server" ID="rptCredit2">
<ItemTemplate>
<lil></li>
</ItemTemplate>
</asp:Repeater>

</contentTemplate>
</asp:UpdatePanel>

</ul>

That said it is still not perfect and will probably need a further work around.

nishanthnair
26 Feb 2009, 4:59 AM
Write this code as shownbelow in ur aspx page;

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(SetYUI);

The above code willc all the SetYUI javascript method when updatepanel is done refreshing the page. :)

now SetYUI() is a javascript function which sets the YUI of your controls. below is my code. uc an alter it as u wish.
function SetYUI()
{

var YUIGroupsButton = new YAHOO.widget.Button("<%= btnCountry.ClientID%>",{type:"menu", menu: "<%=cmbCountryOfPurchase.ClientID %>"});
YUIGroupsButton.set("label", "<%=cmbCountryOfPurchase.SelectedItem.Text%>" );
}