CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 12/2/2003 6:35:21 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 57 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
Sutek
Asp.Net User
Any good ControlBuilder examples?12/2/2003 6:35:21 PM

0/0

Hey all,

I am writing a rather complex control that has repeating items in it. I would like to be able to place markup in the .aspx file to define how it looks (much like a datagrid or data list) like the following:

<ns:MyControl attribute1="x" attribute2="y">
<HeaderTemplate>
<!--- Some HTML Markup --->
</HeaderTemplate>
<ItemTemplate>
<!--- Some more HTML Markup with a way to hook into the control's data members -->
</ItemTemplate>
<FooterTemplate>
<!--- Some more HTML Markup -->
</FooterTemplate>
</ns:MyControl>

I'm pretty sure that the ControlBuilder is the key to accomplishing such a task, however I have found a general lack of information (specifically examples) on the net regarding use of this class to do the above.

Can anyone point me in the direction of a good reference, be it online, or perhaps a book?

Also if I'm way off track in trying to use ControlBuilder to do this, knowing a better method would be most helpful as well :)

Thanks in advance for any guidance!

-Jeff
joteke
Asp.Net User
Re: Any good ControlBuilder examples?12/4/2003 7:21:18 AM

0/0

Book: Developing ASP.NET Server Controla and Components.

Do you mean ITemplate property that can be used to specify a template (ItemTemplate etc are ITemplate properties in databound controls)
Thanks,

Teemu Keiski
Finland, EU
Lostinetdotcom
Asp.Net User
Re: Any good ControlBuilder examples?12/4/2003 11:53:50 AM

0/0

i have once exp . for get the binding container type:


<em:emigrid runat=server>
<menus>
<em:menu Enabled='<%#Containser....%>' Visible='<%#Containser....%>' Text='Open'/>
</menus>
<columns>
<em:TextBoundingColumn .../>
</columns>
</em:emigrid>

because the menu item is just prototype , and it's cant use TemplateContainerAttribute ,
so i wrap the Type for typename of BindingContainer

emigrid declare as:

[ControlBuilder(typeof(EmiGridBuilder))]
public class EmiGrid : ....

code here:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Xml;

using System.Diagnostics;

namespace Grids
{
public class EmiGridBuilder:ControlBuilder
{
public override void Init(System.Web.UI.TemplateParser parser, System.Web.UI.ControlBuilder parentBuilder, System.Type type, string tagName, string id, System.Collections.IDictionary attribs)
{
base.Init(parser,parentBuilder,new EmiGridType(),tagName,id,attribs);
}
public class EmiGridType:ProxyType
{
protected override Type InnerType
{
get
{
StackTrace st=new StackTrace();
for(int i=0;i<st.FrameCount;i++)
{
StackFrame sf=st.GetFrame(i);
MethodBase mi=sf.GetMethod();
if(mi.Name=="BuildPropertyBindingMethod")
{
int offset=sf.GetNativeOffset();
if(offset==472||offset==684)
continue;
return typeof(Grids.EmiGridItem);
}
}
return typeof(Grids.EmiGrid);
}
}
}
}

public abstract class ProxyType:Type
{
abstract protected Type InnerType
{
get;
}
protected object InvokeMethod(params object[] args)
{
string name=new StackTrace(1).GetFrame(0).GetMethod().Name;
return typeof(Type).InvokeMember(name,
BindingFlags.InvokeMethod|BindingFlags.Instance|BindingFlags.NonPublic,
null,InnerType,args);
}

public override System.Reflection.Assembly Assembly
{
get
{
return InnerType.Assembly;;
}
}

public override string AssemblyQualifiedName
{
get
{
return InnerType.AssemblyQualifiedName;
}
}

public override System.Type BaseType
{
get
{
return InnerType.BaseType;
}
}

public override System.Type DeclaringType
{
get
{
return InnerType.DeclaringType;
}
}


public override bool Equals(object o)
{
return InnerType.Equals(o);
}

public override System.Type[] FindInterfaces(System.Reflection.TypeFilter filter, object filterCriteria)
{
return InnerType.FindInterfaces(filter,filterCriteria);
}

public override System.Reflection.MemberInfo[] FindMembers(System.Reflection.MemberTypes memberType, System.Reflection.BindingFlags bindingAttr, System.Reflection.MemberFilter filter, object filterCriteria)
{
return InnerType.FindMembers(memberType,bindingAttr,filter,filterCriteria);
}

public override string FullName
{
get
{
return InnerType.FullName;
}
}

public override int GetArrayRank()
{
return InnerType.GetArrayRank();
}

protected override System.Reflection.TypeAttributes GetAttributeFlagsImpl()
{
return (System.Reflection.TypeAttributes)InvokeMethod();
}

protected override System.Reflection.ConstructorInfo GetConstructorImpl(
System.Reflection.BindingFlags bindingAttr,
System.Reflection.Binder binder,
System.Reflection.CallingConventions callConvention,
System.Type[] types,
System.Reflection.ParameterModifier[] modifiers
)
{
return (System.Reflection.ConstructorInfo)InvokeMethod(bindingAttr,binder,callConvention,types,modifiers);
}

public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetConstructors(bindingAttr);
}

public override System.Reflection.MemberInfo[] GetDefaultMembers()
{
return InnerType.GetDefaultMembers();
}

public override System.Type GetElementType()
{
return InnerType.GetElementType();
}

public override System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetEvent(name,bindingAttr);
}

public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetEvents(bindingAttr);
}

public override System.Reflection.EventInfo[] GetEvents()
{
return InnerType.GetEvents();
}

public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetField(name,bindingAttr);
}

public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetFields(bindingAttr);
}

public override int GetHashCode()
{
return InnerType.GetHashCode();
}

public override System.Type GetInterface(string name, bool ignoreCase)
{
return InnerType.GetInterface(name,ignoreCase);
}

public override System.Reflection.InterfaceMapping GetInterfaceMap(System.Type interfaceType)
{
return InnerType.GetInterfaceMap(interfaceType);
}

public override System.Type[] GetInterfaces()
{
return InnerType.GetInterfaces();
}

public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetMember(name,type,bindingAttr);
}

public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetMember(name,bindingAttr);
}

public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetMembers(bindingAttr);
}

protected override System.Reflection.MethodInfo GetMethodImpl(
string name,
System.Reflection.BindingFlags bindingAttr,
System.Reflection.Binder binder,
System.Reflection.CallingConventions callConvention,
System.Type[] types,
System.Reflection.ParameterModifier[] modifiers)
{
return (System.Reflection.MethodInfo)InvokeMethod(name,bindingAttr,binder,callConvention,types,modifiers);
}

public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetMethods(bindingAttr);
}

public override System.Type GetNestedType(string name, System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetNestedType(name,bindingAttr);
}

public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetNestedTypes(bindingAttr);
}

public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr)
{
return InnerType.GetProperties(bindingAttr);
}

protected override System.Reflection.PropertyInfo GetPropertyImpl(
string name,
System.Reflection.BindingFlags bindingAttr,
System.Reflection.Binder binder,
System.Type returnType,
System.Type[] types,
System.Reflection.ParameterModifier[] modifiers)
{
return (System.Reflection.PropertyInfo)InvokeMethod(name,bindingAttr,binder,returnType,types,modifiers);
}

public override System.Guid GUID
{
get
{
return InnerType.GUID;
}
}

protected override bool HasElementTypeImpl()
{
return (bool)InvokeMethod();
}

public override object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters)
{
return InnerType.InvokeMember(name,invokeAttr,binder,target,args,modifiers,culture,namedParameters);
}

protected override bool IsArrayImpl()
{
return (bool)InvokeMethod();
}

public override bool IsAssignableFrom(System.Type c)
{
return InnerType.IsAssignableFrom(c);
}

protected override bool IsByRefImpl()
{
return (bool)InvokeMethod();
}


protected override bool IsCOMObjectImpl()
{
return (bool)InvokeMethod();
}

protected override bool IsContextfulImpl()
{
return (bool)InvokeMethod();
}

public override bool IsInstanceOfType(object o)
{
return InnerType.IsInstanceOfType(o);
}

protected override bool IsMarshalByRefImpl()
{
return (bool)InvokeMethod();
}

protected override bool IsPointerImpl()
{
return (bool)InvokeMethod();
}

protected override bool IsPrimitiveImpl()
{
return (bool)InvokeMethod();
}


public override bool IsSubclassOf(System.Type c)
{
return InnerType.IsSubclassOf(c);
}

protected override bool IsValueTypeImpl()
{
return (bool)InvokeMethod();
}

public override System.Reflection.MemberTypes MemberType
{
get
{
return InnerType.MemberType;
}
}

public override System.Reflection.Module Module
{
get
{
return InnerType.Module;
}
}

public override string Namespace
{
get
{
return InnerType.Namespace;
}
}

public override System.Type ReflectedType
{
get
{
return InnerType.ReflectedType;
}
}

public override string ToString()
{
return InnerType.ToString();
}

public override System.RuntimeTypeHandle TypeHandle
{
get
{
return InnerType.TypeHandle;
}
}

public override System.Type UnderlyingSystemType
{
get
{
return InnerType.UnderlyingSystemType;
}
}

public override object[] GetCustomAttributes(System.Type attributeType, bool inherit)
{
return InnerType.GetCustomAttributes(attributeType,inherit);
}

public override object[] GetCustomAttributes(bool inherit)
{
return InnerType.GetCustomAttributes(inherit);
}

public override bool IsDefined(System.Type attributeType, bool inherit)
{
return InnerType.IsDefined(attributeType,inherit);
}

public override string Name
{
get
{
return InnerType.Name;
}
}
}
}

Lostinet (Li Jian Dai) .NET MVP

http://www.lostinet.com/ for LWTree/DatePicker

http://www.contextboundmodel.net/ for AOP.NET
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005
ASP.NET in a Nutshell: In a Nutshell Authors: G. Andrew Duthie, Matthew MacDonald, Pages: 979, Published: 2003
Tool and Manufacturing Engineers Handbook: A Reference Book for Manufacturing Engineers, Managers, and Technicians Authors: Tom Drozda, Charles Wick, Society of Manufacturing Engineers, Pages: 0, Published: 1983
Geo-Business: GIS in the Digital Organization Authors: James B. Pick, Pages: 396, Published: 2007
ASP.NET AJAX Programming Tricks Authors: Matthew David Ellis, Matthew Ellis, Pages: 388, Published: 2007
Professional ASP.NET 1.0: Updated and Tested for Final Release of ASP.NET V.1.0 Authors: Richard Anderson, Alex Homer, Dave Sussman, Karli Watson, Pages: 1354, Published: 2002
UML 2002--the Unified Modeling Language: Model Engineering, Concepts, and Tools : 5th International Conference, Dresden, Germany, September 30-October 4,2002 : Proceedings Authors: Jean-Marc Jézéquel, Heinrich Hussmann, Stephen Cook, Pages: 447, Published: 2002

Web:
ITemplate and ControlBuilder - ASP.NET Forums It is a very good point, though, that in my example the class appears unnecessary. I can only go off the code that you provide and so any ...
Attribute, Control - Builder AU This is true for many of the standard ASP.NET features. A good example is the TextBox Web control, which offers plenty of options for building applications. ...
David Ebbo's blog : Creating a ControlBuilder for the page itself I know this is just an example scenario for the file-level control builder, but in fact for this specific scenario, there isn't a need to write a control ...
Communication between Matlab Simulink and ABB Advant Control Builder An example of how a working Simulink and Advant Control Builder system looks like .... The toolbox Simulink does not provide any possibilities to simulate a ...
UMC800 Control Builder User's Guide The Control Builder operates on any computer platform that meets the ..... For example: To open the FILE menu in the Control Builder main window, ...
Rory Primrose | Creating Web Custom Controls With ASP.Net 1.1 ... Our good friends at Microsoft are obviously doing a little extra behind the .... I will provide an example of ControlBuilder support in a later article. ...
Cache Control builder The Cache Control builder allows you to cache the output of a specific ... This database scenario presents a good opportunity to cache results (in this case ...
CodeProject: ASP.NET Color DropDown Control. Free source code and ... An example of persisting and parsing a custom collection in an ASP. ... You are correct - I had listed the ControlBuilder in the wrong namespace D'Oh! ...
UMC800 Control Builder User’s Guide 14.5.1 Example 1 - Basic Start/Stop Circuit with On Delay Timer. ...... The Control Builder operates on any computer platform that ...
Nikhil Kothari's Weblog : DomainDataSource Server Control: LINQ + ... Jan 15, 2009 ... My DomainDataSource control has an associated ControlBuilder that .... support for LINQ - might be good to report this to the EF team. ...




Search This Site:










createuserwizard

how to constraint password to 8 characters?

how to get a control inside a rolegroup at loginview ?

asp.net account lockout

need to insert users into asp.net 2.0's membership, roles, and profile tables

adam and forced password change

when lastactivedate get update?

how to custom membership ?

please help. problem: pressing ie's back button allows recent data to be viewed after user has logged out

membershipuser and role classes

setting password for aspnetdb

displaying users with profile properties in a gridview

hackprofing asp.net web app

user login name

forms based authentication (asp.1.1)

membership and custom profile provider

getting role description

exception login failed for user '(null)'

use existing login control with role and membership provider

some direction on implementing a role provider

membership provider is useless!! with aspnet_checkschemaversion problem.

impersonation and querying ldap over ssl

password not recognized

access denied error on file copy

can't get domain security group access to application

redirect to the requested url

sql membership providers

allow user to see specific files using web config

is building onto aspnetdb.mdf a bad idea vs. moving the membership related schema?

running admin tasks from asp.net. how can i?

  Privacy | Contact Us
All Times Are GMT