Thanks again guys for all your great advice. I really liked ltctech' idea and came up with a solution that I'm not sure is going to work yet, it works in theory and simple pages, I'll have to made tweaks and modifications to it because it's not complete yet.
What I did is built a some methods on my page.basepage class file. ucInit for initialization of a Ext.Net object I build in code behind, an Invoke method that will build for me a method call generated from string data and a ExcuteUGAction Method to execute any direct method calls. Again I still have to change a few things and add params etc but in theory I should be able to build a class file with methods to generate my "ucControl" in code behind, render it to the panel I need to add it to, and built all it's methods that are needed for the control. I tested it out and to my amazement it actually works, are there better ways, maybe like WebService etc, but I thought about trying to keep it all within the project using just objects. I'm by no means an expert programmer as you can tell but I'm wondering what your thoughts are about putting something like this to use?
BasePage Code
[DirectMethod(ShowMask=true,Msg="Loading...")]
public void ucInit(string ugClass, string ugMethodName, string panelName)
{
List<string> mParams = new List<string>();
mParams.Add(panelName);
Invoke(ugClass, ugMethodName, mParams);
}
public void Invoke(string typeName, string methodName, List<string> mParams)
{
Type type = Type.GetType(typeName);
object instance = Activator.CreateInstance(type);
MethodInfo method = type.GetMethod(methodName);
method.Invoke(instance,mParams.ToArray<object>());
}
[DirectMethod]
public void ExecuteUGAction(string ugClass, string ugMethodName)
{
List<string> mParams = new List<string>();
Invoke(ugClass, ugMethodName, mParams);
}
Class Code With Methods
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ext.Net;
namespace DBI.Web.EMS.Views
{
public class ugSecurityRoles
{
public static void initItem(string panelName)
{
//Get Render Panel
Ext.Net.Panel cp = X.GetCmp<Ext.Net.Panel>(panelName);
Ext.Net.Button btn = new Ext.Net.Button();
btn.ID = "button1";
btn.Text = "test button";
btn.Listeners.Click.Handler = "#{DirectMethods}.ExecuteUGAction('DBI.Web.EMS.Views.ugSecurityRoles','Alert');";
Ext.Net.Panel panel = new Ext.Net.Panel();
panel.ID = "panel1";
panel.Border = false;
panel.Items.Add(btn);
panel.AddTo(cp);
}
public static void Alert()
{
X.GetCmp<Ext.Net.Button>("button1").Text = "Button 2";
X.Msg.Alert("testing", "testing direct Method").Show();
}
}
}
Executed by something like
<ext:MenuItem ID="uxSecurity" runat="server" Text="Security">
<Listeners>
<Click Handler="#{DirectMethods}.ucInit('DBI.Web.EMS.Views.ugSecurityRoles','initItem','uxCenter');"></Click>
</Listeners>
</ext:MenuItem>