I am trying to create a custom control and the render method is shown below.
I get an "Object reference not set to an instance of an object" error on the bulletList.RenderControl(Writer); line.
Any ideas?
protected override void Render(HtmlTextWriter Writer)
{
if (TermSetList != null && TermSetList.Count > 0)
{
BulletedList bulletList = new BulletedList();
bulletList.Click += new BulletedListEventHandler(BulletListItem_Click);
bulletList.DisplayMode = BulletedListDisplayMode.LinkButton;
bulletList.CssClass = "tabs";
foreach (KeyValuePair<String, String> item in TermSetList)
{
ListItem listItem = new ListItem();
listItem.Text = item.Key;
listItem.Value = item.Value;
bulletList.Items.Add(listItem);
}
if (!this.Page.IsPostBack)
{
bulletList.Items[0].Selected = true;
}
bulletList.RenderControl(Writer);
base.Render(Writer);
}
}
Writerobject properly instantiated when the Render method receives it?