Accessing Child Controls in a composite custom control
I've created a custom control with several child controls (like checkboxes
and textboxes). However, in order to have a nice layout I added all of the
text boxes and checkboxes to a table control like this:
Table t = new Table();
TableRow tr = new TableRow();
TableCell td1 = new TableCell();
TableCell td2 = new TableCell();
td1.VerticalAlign = VerticalAlign.Top;
Label lblName = new Label();
lblName.Text = "Product Name: ";
productname.ID = "productname";
productname.Columns = 70;
So, my custom control has properties that pass through to the child textbox
and checkbox controls. I had this working before i added the table for
layout but on since the addition of the child controls to the custom
controls ControlsCollection is not as orderly I can't figure out how to
reference the child control anymore I've tried this:
public string ProductName
The IndexOf method doesn't seem to be able to find the control (all of the
chilc controls, like productname, are declared at the class level).
So how do I reference child controls when there is no orderly way of adding
them to the Controls collection?
|All times are GMT. The time now is 10:47 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.