0
votes

Here is my code:

protected override void OnInit(EventArgs e)
{
        ScriptManager sm = ScriptManager.GetCurrent(this.Page);
        MethodInfo m = (
        from methods in typeof(ScriptManager).GetMethods(
            BindingFlags.NonPublic | BindingFlags.Instance
            )
        where methods.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")
        select methods).First<MethodInfo>();

        m.Invoke(sm, new object[] { updatePanel});
        base.OnInit(e);
}

aspx file:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" 
OnUnload="UpdatePanel_Unload"></asp:UpdatePanel>

Now it shows the error:

'ASP.v4_inbox_new_aspx' does not contain a definition for 'UpdatePanel_Unload' and no extension method 'UpdatePanel_Unload' accepting a first argument of type 'ASP.v4_inbox_new_aspx' could be found (are you missing a using directive or an assembly reference?)

The name 'updatePanel' does not exist in the current context

1
I thinks its telling you that UpdatePanel_Unload function is not present in the code behind file. - Waqar Ahmed
where?, Its full source code, and it is placed in master file: asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> - pcs

1 Answers

0
votes

'ASP.v4_inbox_new_aspx' does not contain a definition for 'UpdatePanel_Unload' and no extension method 'UpdatePanel_Unload' accepting a first argument of type 'ASP.v4_inbox_new_aspx' could be found (are you missing a using directive or an assembly reference?)

This is a result of your markup:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" OnUnload="UpdatePanel_Unload"></asp:UpdatePanel>

Particularly, OnUnload="UpdatePanel_Unload" is wrong since UpdatePanel_Unload does not exist in your code.

The name 'updatePanel' does not exist in the current context E:\selva\19-09-2015\AlertID4\UI\V4\Inbox_new.aspx.cs

This is a result of your code:

m.Invoke(sm, new object[] { updatePanel});

updatePanel is not defined anywhere.