M
Mr Flibble
I've created a baseclass thusly:
public class BasePage : System.Web.UI.Page
and then I have another class Default3 created from this:
public partial class Default3 : BasePage
I've put all my common code in BasePage and so I have my implementation
in one place now for the common features of my website. All good so far.
A webpage with lots of code, all of which inherited. Now I can tailor
each page specifically.
One problem is that I have a WebChart control in my page.
e.g. <Web:ChartControl /> in my .aspx.
I'd like this control to be in all my pages to but you cant inherit the
HTML from the .aspx can you? So what I've done is I've created a method
that sets up the webchart control, and put this in the base class then I
get Default3 to call this method passing the ChartControl of its aspx as
a parameter. So I have this method signature in BasePage;
public void SetupChart(ref ChartControl uxMyChart)
I have a few questions, and I hope I'm explaining what I've done
clearly! One is that although my webpage calls this SetupChart, the
chart which correctly creates a PNG creates the file *BUT* the src= part
of the rendered HTML is blank. So this method is not working for some
reason, when the code to setup the chart is in BasePage and not in
Default3. This has to be some oversight on my part, that hopefully
someone can explain?!
On a probably more important note, is there a better way of sharing the
code to setup the chart so that I dont have to call some method?
Also now that I have the relationship Web.UI.Page -> BasePage ->
Default3, if I want to put something in the Page_Load method in Default3
am I still able to? Am I able to have an implementation of Page_Load
both in the BasePage AND in Default3?
Hope I've explained my situation well and its not as clear as mud!
Flibble
public class BasePage : System.Web.UI.Page
and then I have another class Default3 created from this:
public partial class Default3 : BasePage
I've put all my common code in BasePage and so I have my implementation
in one place now for the common features of my website. All good so far.
A webpage with lots of code, all of which inherited. Now I can tailor
each page specifically.
One problem is that I have a WebChart control in my page.
e.g. <Web:ChartControl /> in my .aspx.
I'd like this control to be in all my pages to but you cant inherit the
HTML from the .aspx can you? So what I've done is I've created a method
that sets up the webchart control, and put this in the base class then I
get Default3 to call this method passing the ChartControl of its aspx as
a parameter. So I have this method signature in BasePage;
public void SetupChart(ref ChartControl uxMyChart)
I have a few questions, and I hope I'm explaining what I've done
clearly! One is that although my webpage calls this SetupChart, the
chart which correctly creates a PNG creates the file *BUT* the src= part
of the rendered HTML is blank. So this method is not working for some
reason, when the code to setup the chart is in BasePage and not in
Default3. This has to be some oversight on my part, that hopefully
someone can explain?!
On a probably more important note, is there a better way of sharing the
code to setup the chart so that I dont have to call some method?
Also now that I have the relationship Web.UI.Page -> BasePage ->
Default3, if I want to put something in the Page_Load method in Default3
am I still able to? Am I able to have an implementation of Page_Load
both in the BasePage AND in Default3?
Hope I've explained my situation well and its not as clear as mud!
Flibble