Dynamic LoginView and AnonymousTemplate?

B

bradwiseathome

I would like to dynamically add a LoginView and an AnonymousTemplate to
my ASP.NET 2.0 page. I can't use the page template at all, just the
code-behind page. I tried to create my own class that implements
ITemplate, and then set that as the AnonymousTemplate for the
LoginView. The class is below, it's not working. Help!

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace test
{
public class AnonTest : TemplateControl , ITemplate , ILocalized
{
private LiteralControl _literalControl;
void ITemplate.InstantiateIn( Control parentContainer )
{
this._literalControl = new LiteralControl();
this._literalControl.DataBinding += new EventHandler(
_literalControl_DataBinding );
parentContainer.Controls.Add( this._literalControl );
}
void _literalControl_DataBinding( object sender , EventArgs e )
{
LiteralControl literalControl = sender as LiteralControl;
literalControl.Text = "future database driven".
}
}
}
 

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,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top