I have the following update panel tag:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" onload="load()">
in my header I have the following:
<script type="text/javascript" >
function load() {
doSomething....
}
</script>
When I run this I get: Compiler Error Message: CS1061: 'ASP.aform_webform2_aspx' does not contain a definition for 'load' and no extension method 'load' accepting a first argument of type 'ASP.aform_webform2_aspx' could be found (are you missing a using directive or an assembly reference?)
Can anyone 开发者_如何学运维help me figure out how to call that function whenever my update panel loads?
There is no onload
property on the update panel. You should remove it. You may take a look at the following article. You could use:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(load);
and the load()
will be triggered after every update panel update. But if you want to target a specific update panel you could use the following in the code behind:
ScriptManager.RegisterStartupScript(this, this.GetType(), "foo", "load();", true);
there is a function also can do
function pageLoad()
{
// do some thing after each partial post back happen
}
Regards
精彩评论