Using the Callback Method on a View in ASP.NET MVC

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-03-26T10:15:39Z Indexed on 2010/03/26 12:33 UTC
Read the original article Hit count: 330

Filed under:
|
|

I have a master page with that code:

    public string CallbackMethod;

    protected void Page_Load(object sender, EventArgs e)
    {
        CallbackMethod = Page.ClientScript.GetCallbackEventReference(this, "message", 
                         "Dodanie", "context", true);
    }

    /other code here/

then, in the View (which is based on that master page) I need to invoke the CallbackMethod string, but the problem is, the framework firstly renders the View, and then invokes the Page_Load method. As the obvious result, the error appears:

the name 'CallbackMethod' does not exist in the current context.

How do I fix this?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about c#