Capture an Event in a composite control From control on a page

G

gdick

In the most simple terms assume we have a Composite WebServer control

This Composite Control (CC) is just a "label"

private Label _lblCommissionType;

protected override void CreateChildControls()
{
Controls.Clear();

this._lblCommissionType = new Label();
this._lblCommissionType.Text ="Premium: ";
this.Controls.Add(_lblCommissionType);
}

protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
_lblCommissionType.RenderControl(writer);
}


I want to add an Event Handler to this CC which captures the event of a
change in standard DropDownList drawn beside it on the page. i.e.
DropDownList1

When the Event is captured I want to change the text of the (CC) label

Please Help -- just ask for more details if required

C#
VS.NET 2003
..NET v1.1
 
G

Guest

There are some rather exotic ways of handling this. Here's the simplest
one....without getting all into TypeConverters and stuff:

Create a property called "DropdownName" that is a string.
When that property is set, Do a FindControl on the page for the Dropdown.
Register an Event Handler for the Dropdown control that changes the label's
text.
 

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,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top