Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Template control error

Thread Tools

Template control error
Posts: n/a
Hi group,

i'm trying to create a template control, very easy with nothing else a
button in it :

<Test:TestTemplate ID="test" runat="server" />

public class TestTemplate : WebControl, INamingContainer
private ITemplate _template;
private TestPanel _panel;

public TestPanel Panel
get { EnsureChildControls(); return _panel; }

public virtual ITemplate Template
get { return _template; }
set { _template = value; }

public override ControlCollection Controls
get { EnsureChildControls(); return base.Controls; }

protected override void CreateChildControls()
_panel = new TestPanel();
ITemplate template = Template;
if (template == null)
template = new DefaultTemplate();
Button b = new Button();
b.Text = "OK";

public override void DataBind()
ChildControlsCreated = true;

private sealed class DefaultTemplate : ITemplate
void ITemplate.InstantiateIn(Control container)

public class TestPanel : Panel, INamingContainer

When I click on the button, after postback, I have a

the call stack :

System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument) +93

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

What should I do ?

Thanks for your help.

Best regards
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use the template member function of a template in the memberfunction of another template class? Peng Yu C++ 3 10-26-2008 03:51 PM
template template arguments: expected a class template, got `Component<T1, T2, T3> C++ 1 06-08-2007 07:10 AM
Compiler error occurred when try to use a flexible template expression in preprocessor definesCompiler error occurred when try to use a flexible template expression in preprocessor defines snnn C++ 6 03-14-2005 04:09 PM
Re: A Newbie Question about template template template tom_usenet C++ 0 07-24-2003 12:06 PM
Re: A Newbie Question about template template template Chris Theis C++ 2 07-24-2003 09:42 AM