开发者

ASP.NET: UpdatePanel & OnLoad Event

I'm trying to execute some javascript code on my UpdatePanel's OnLoad event like so:

<asp:UpdatePanel ID="updDropDowns" runat="server" OnLoad="javascript:ResetButtons();">

But I keep getting "'javascript' is not a member of ASP.reasons_aspx".

I tried doing

Me.updDropDowns.Attributes.Add("OnLoad", "javascript:ResetButtons();")

But I can't reference the 'Attributes' property of开发者_高级运维 an UpdatePanel in the VB code-behind.

How else can I accomplish this?

Thanks,

Jason


The easiest way is to register a clientscript:

ScriptManager.RegisterStartupScript(this.GetType(), "pagestart", "ResetButtons();", true)

edit: Updated per Tim's note. I referenced the wrong class


As far as I know, their is no client OnLoad event for an updatepanel (it's rendered as a div or a span). It's only server side. And dont forget, the event will be fired each and every time the panel gets updated. Why dont you just reset your buttons server side ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜