c# - ASP.NET LoadControl Use of keyword 'base' is not valid in this context -
I want to load .csx control to a web service, load some values in it and then control the HTML content of this control return back . I have something like this:
[WebMethod (EnableSession = true)] Public Zero GetHTML () {UserControl Loader = New UserControl (); MyCustomReport ReportControl = (MyCustomReport) loader.LoadControl ("~ / / / path / for / .ccx"); ReportControl.DataBind (); Return "TODO"; }
MyCustomReport override DataBind ()
:
public override zero DataBind () {base.DataBind (); // etc}
line base.DataBind ()
throws a NullReferenceException
and the debugger says:
The use of the keyword 'base' in this context is not valid
Any help would be appreciated, thanks!
Try this:
Public override zero return binding () { Base.OnDataBinding (); // Here is the virtual DataBind
in other stuff ...}
but there is a virtual OnDataBinding
method in it That means this method means to override you.
Comments
Post a Comment