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".
}
}
}
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".
}
}
}