Tuesday 15 March 2011

C# ASP Callback Adding Class Issue -


I created an app alone and it works with my callback. I'm trying to integrate it into a big app and I'm having some problems.

My only app callback code:

  Public partial range Default: System Web. UI page, system. Web. UI .ICallbackEventHandler {Secure Zero Page_load (Object Sender, EventArgse E) {// Get Unimportant Specific Code / Client Script of // Page and Specify Client Script Manager Career Script Manager cm = Page.ClientScript; // Callback Reference String cbReference = cm.GetCallbackEventReference generated (this, "arg", "handler," ""); // callback script block string cbScript = "create function call server (arg, context) {" + cbReference + ";}"; // block cm Register. Registry ClientBlock (This Gate Type (), "Call Server", CBSPT, True); } Public Zero RiseCallbackEvent (string eventArgument) {// Unimportant specific code // This method will be called by the client; Your business logic here // Parameter "eventArgument" is actually the parameter of the call server (ARG, context) "ARG" GetCallbackResult (); // trigger callback} public string GetCallbackResult () {// Unimportant specific code return callback message; } // more specific unimportant stuff}   

Why can not I just add my big app like this:

  Public category My_App_ItemViewer: abstractItemViewer, System. Web.UI.Page, System.Web.UI.ICallbackEventHandler   

In Visual Studio, I get an error that says 'page' is expected for interface name < P> I get an error in the callback code, where 'static property' can not be used in the context of client script ' Client certification in non-static context.

I did not really understand these conditions ... I do not have a CS degree or anything, so if someone can explain it, then this is great (maybe even the greatest), thanks!

C # does not support multiple heritage, so you can not do the following line:

  public class My_App_ItemViewer: abstractItemViewer, System.Web.UI.Page, System.Web.UI.ICallbackEventHandler   

Just to clarify, the way you As written above, the C # compiler thinks that the abstractItemViewer is a class that you are trying to get from the compiler, then looks at the "System.Web.UI.Page" section and an interface called that , Which he did not find, because System.Web.UI.Page is a class and not the interface; Error in this way

You can, however, implement multiple interfaces, so that you can do the following:

  Public category My_App_ItemViewer: System.Web.UI.Page, System Web.UI .ICallbackEventHandler, IAbstractItemViewer    

No comments:

Post a Comment