New to Controls - help with Checkbox RenderContents(...)

R

Ryan Ternier

I'm new to creating controls, so I wanted to start with something simple.


A simple checkbox, but with a small footer tag underneath the acual text
to put anything you want.

I'm not worried about the formatting yet, that's easy to do. My question
lies with the RenderContents() method. In my user control, it's not
even fireing mine, it's displaying a regular check box.

here's the code:

private string footNoteCss;
private string footNote;
public string FootNoteCss
{
get
{
return (footNoteCss != null ? footNoteCss:String.Empty);
}
set
{
footNoteCss = value;
}
}

public string FootNote
{
get
{
return (footNote != null ? footNote : String.Empty);
}
set
{
footNote = value;
}
}

//Overrides the REnderContents method
protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
{
writer.Write(ActivateFootNote(base.Text));
}

private string ActivateFootNote(string theText)
{
string buf = theText + "<div class='" + footNoteCss + "'>" + footNote
+ "</div>";
return buf;
}
}


-----

I've overriden the Render event, and it calls mine fine, but I don't
want to override Render... i want to override the content.

Any suggestions?

/RT
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top