the scenario is like so :
say i have a table , html table , the table has few <td>
Controls each has a set of controls,
that is related to that specific <td>
, but not necessarily enclosed within the <td>
scope.
for example :
<asp:Label ID="Lbl_TlTp1" runat="server">
<table>
<tr>
<td ID="TD_1" runat="server">
<asp:Label ID="LBL_1" runat="server" />
</td>
<td>
<asp:TextBox ID="TBX_1" runat="server" />
</td>
</tr>
</table>
now i want to be able to address tips Label Lbl_TlTp1
, DataLabel LBL_1
And the TextBox TBX_1
as A set or a collection, to be very flexible (allowing Enumeration etc'..)
is it by making it(that "set" ) as a class or object that encapsulates those control items... each as a member ?
i would like to later be able to manipulate the "set" as one entity
setOfControls Sct1 = new setOfControls()
public void ActAppon(setOfControls section)
{
execProcedure1(section);
foreach(control ctr in section)
{
doTheThing(ctr);
}
}
...etc'
what is the approach to achieve this solution ?
Make a
UserControl (.ascx)
for the markup, and expose the properties for your web-controls, and work on that..Make a
UserControl (.ascx)
named asControlGroup.ascx
In its code behind
(ControlGroup.ascx.cs)
make Properties. likeAnd Now you can use this UserControl In any ASPX Page. For it register your usercontrol on a page like
And Use this Control in markup like
And In Page load of the page you can access this control and its property. like
Or you can load your usercontrol programatic. like
and can add it in another control, on even populate a list for these controls.
I hope It will help you.