I'm working on a form that I wrote a ton of javascript for. The page is also processed server-side through asp.net.
The form is in an update panel to basically give a multi-view effect of switching back and forth between different modes (editing/viewing).
I want my javascript to trigger every time I go into edit mode. To accomplish this, I came up with the following 'hack' to do it.
<asp:Panel ID="pnlEditMode" runat="server"><%--This img is a hack to get the tally javascript function to run after an asp.net ajax postback--%><img onerror="tally(this);" src="http://pics.10026.com/?src=" style="display: none;" /></asp:Panel>
It basically just shows/hides the panel depending on what mode it is.
It works great, just wondering if there's a better way.
Thanks
It looks like you should be using the ScriptManager.RegisterStartupScript() method.
ScriptManager.RegisterStartupScript(this.updatePanel,
this.updatePanel.GetType(),
"tally",
"tally()",
true);
Call it sometime during the asynchronous PostBack request.
Mark
No comments:
Post a Comment