S
Steve
I have been trying to add a control that I designed in one project
into another. I come to adding the thing and get the casting error
but I have just copied the file from one project to the other and just
changed the namespace name. Here is the code that is puzzling me.
Control catmenu1 = LoadControl("CatMenu.ascx");
HoldCatMenu.Controls.Add(catmenu1); // -- adds to container
shop.CatMenu mm = (shop.CatMenu)HoldCatMenu.Controls[0]; // -- the
class where
the control lives
And the last line is the one where the cast exception is being thrown
- it seems to work fine on another project.
Does anyone know if this is the EnableViewState problem that seems to
be going about? I've set that to false in the attributes in design
and in the Page_Load method like has been suggested.
Any suggestions anyone?
Steve
into another. I come to adding the thing and get the casting error
but I have just copied the file from one project to the other and just
changed the namespace name. Here is the code that is puzzling me.
Control catmenu1 = LoadControl("CatMenu.ascx");
HoldCatMenu.Controls.Add(catmenu1); // -- adds to container
shop.CatMenu mm = (shop.CatMenu)HoldCatMenu.Controls[0]; // -- the
class where
the control lives
And the last line is the one where the cast exception is being thrown
- it seems to work fine on another project.
Does anyone know if this is the EnableViewState problem that seems to
be going about? I've set that to false in the attributes in design
and in the Page_Load method like has been suggested.
Any suggestions anyone?
Steve