How do I pass an object to webcontrol that is loaded using the "LoadLontrol" method ? .NET 2005 Beta

D

Da Rabit

Hi all,
Because of the nature of my application, I have a web control that is being
loaded and added to my form at runtime using the LoadControl method.
Beacuse of the new framework, it is impossible to inherit from my own
version of the "System.Web.UI.UserControl" class as the code seems to be
created during the compile ! "Thanks again for the black box programming MS
!!!"
My questions are ...
1) Is there a way to pass an object to my control after I have created it
....
2) Is there a way to change the web control to inherit from anything other
then the "System.Web.UI.UserControl" class that is being inherited for a
webcontrol in 2005 ?



This is an example of the code that is generated by .NET, I need to change
the System.Web.UI.UserControl inheritance !





#pragma checksum "E:\Local Files\Vss\Product Development and
Delivery\Project Office Projects\P0014 2004 Dot Net
ReWrite\BISMOD\SOURCE\Website\COR\LAYOUT\Controls\ctlWorkflowSetup.ascx"
"{406ea660-64cf-4c82-b6f0-42d48172a799}" "512CD8579573A7626409E82582B67450"

//------------------------------------------------------------------------------

// <autogenerated>

// This code was generated by a tool.

// Runtime Version:2.0.40607.16

//

// Changes to this file may cause incorrect behavior and will be lost if

// the code is regenerated.

// </autogenerated>

//------------------------------------------------------------------------------

using System;

using System.Collections;

using System.Collections.Specialized;

using System.Configuration;

using System.Text;

using System.Text.RegularExpressions;

using System.Web;

using System.Web.Caching;

using System.Web.Profile;

using System.Web.Security;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.Imaging;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;





[System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]

public partial class ctlWorkflowSetup_ascx : System.Web.UI.UserControl {


private static bool @__initialized = false;


private static object @__stringResource;


public ctlWorkflowSetup_ascx() {

AppRelativeVirtualPath = "~/COR/LAYOUT/Controls/ctlWorkflowSetup.ascx";

if ((global::ctlWorkflowSetup_ascx.@__initialized == false)) {

global::ctlWorkflowSetup_ascx.@__stringResource =
System.Web.UI.TemplateControl.ReadStringResource(typeof(global::ctlWorkflowSetup_ascx));

global::ctlWorkflowSetup_ascx.@__initialized = true;

}

}


protected System.Web.Profile.DefaultHttpProfile Profile {

get {

return ((System.Web.Profile.DefaultHttpProfile)(this.Context.Profile));

}

}


protected System.Web.HttpApplication ApplicationInstance {

get {

return ((System.Web.HttpApplication)(this.Context.ApplicationInstance));

}

}


public override string AppRelativeTemplateSourceDirectory {

get {

return "~/COR/LAYOUT/Controls";

}

}


private void @__BuildControlTree(ctlWorkflowSetup_ascx @__ctrl) {

}


protected override void FrameworkInitialize() {

base.FrameworkInitialize();

SetStringResourcePointer(global::ctlWorkflowSetup_ascx.@__stringResource,
0);

this.@__BuildControlTree(this);

}

}
 
I

intrader

Hi all,
Because of the nature of my application, I have a web control that is being
loaded and added to my form at runtime using the LoadControl method.
Beacuse of the new framework, it is impossible to inherit from my own
version of the "System.Web.UI.UserControl" class as the code seems to be
created during the compile ! "Thanks again for the black box programming MS
!!!"
My questions are ...
1) Is there a way to pass an object to my control after I have created it
...
2) Is there a way to change the web control to inherit from anything other
then the "System.Web.UI.UserControl" class that is being inherited for a
webcontrol in 2005 ?



This is an example of the code that is generated by .NET, I need to change
the System.Web.UI.UserControl inheritance !





#pragma checksum "E:\Local Files\Vss\Product Development and
Delivery\Project Office Projects\P0014 2004 Dot Net
ReWrite\BISMOD\SOURCE\Website\COR\LAYOUT\Controls\ctlWorkflowSetup.ascx"
"{406ea660-64cf-4c82-b6f0-42d48172a799}" "512CD8579573A7626409E82582B67450"

//------------------------------------------------------------------------------

// <autogenerated>

// This code was generated by a tool.

// Runtime Version:2.0.40607.16

//

// Changes to this file may cause incorrect behavior and will be lost if

// the code is regenerated.

// </autogenerated>

//------------------------------------------------------------------------------

using System;

using System.Collections;

using System.Collections.Specialized;

using System.Configuration;

using System.Text;

using System.Text.RegularExpressions;

using System.Web;

using System.Web.Caching;

using System.Web.Profile;

using System.Web.Security;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.Imaging;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;





[System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]

public partial class ctlWorkflowSetup_ascx : System.Web.UI.UserControl {


private static bool @__initialized = false;


private static object @__stringResource;


public ctlWorkflowSetup_ascx() {

AppRelativeVirtualPath = "~/COR/LAYOUT/Controls/ctlWorkflowSetup.ascx";

if ((global::ctlWorkflowSetup_ascx.@__initialized == false)) {

global::ctlWorkflowSetup_ascx.@__stringResource =
System.Web.UI.TemplateControl.ReadStringResource(typeof(global::ctlWorkflowSetup_ascx));

global::ctlWorkflowSetup_ascx.@__initialized = true;

}

}


protected System.Web.Profile.DefaultHttpProfile Profile {

get {

return ((System.Web.Profile.DefaultHttpProfile)(this.Context.Profile));

}

}


protected System.Web.HttpApplication ApplicationInstance {

get {

return ((System.Web.HttpApplication)(this.Context.ApplicationInstance));

}

}


public override string AppRelativeTemplateSourceDirectory {

get {

return "~/COR/LAYOUT/Controls";

}

}


private void @__BuildControlTree(ctlWorkflowSetup_ascx @__ctrl) {

}


protected override void FrameworkInitialize() {

base.FrameworkInitialize();

SetStringResourcePointer(global::ctlWorkflowSetup_ascx.@__stringResource,
0);

this.@__BuildControlTree(this);

}

}
All kind of things are possible using reflection and dynamic loading.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top