P
Paul
Hi All,
I have a control on a page that is a listing control.
It is feed by other controls on the page.
I am trying, at design time, to detect any controls that are associated
with my list control.
I am currently using the IReferenceService here is my code.
StringBuilder sbOut = new StringBuilder();
//IReferenceService iRef =
this.Site.GetService(typeof(IReferenceService)) as IReferenceService;
IReferenceService iRef =
this.Site.GetService(typeof(IReferenceService)) as IReferenceService;
Object[] controls = iRef.GetReferences(typeof(IControl));//
as IControl[];
sbOut.Append("<ul>");
sbOut.Append("<li>");
sbOut.Append( this.Page.Controls.Count );
sbOut.Append("</li>");
for (int iLoop = 0; iLoop < controls.Length; iLoop++)
{
IControl ctrl = (IControl)controls[iLoop];
string sName = ((IControl)ctrl).displayName;
string sGroupName = ((IControl)ctrl).GroupName;
// If the control is part of a group for the control
if (ctrl.GroupName != "" &&
(this.groupNames.IndexOf(ctrl.GroupName) > -1))
{
sbOut.Append("<li>Header : ");
sbOut.Append(ctrl.displayName);
sbOut.Append("</li>");
}
}
sbOut.Append("</ul>");
//lblOut.Text = sbOut.ToString();
return sbOut.ToString();
My problem is that it can ONLY see controls that appear BEFORE it in
the page.
Does anyone know how I might get around this?
I have a control on a page that is a listing control.
It is feed by other controls on the page.
I am trying, at design time, to detect any controls that are associated
with my list control.
I am currently using the IReferenceService here is my code.
StringBuilder sbOut = new StringBuilder();
//IReferenceService iRef =
this.Site.GetService(typeof(IReferenceService)) as IReferenceService;
IReferenceService iRef =
this.Site.GetService(typeof(IReferenceService)) as IReferenceService;
Object[] controls = iRef.GetReferences(typeof(IControl));//
as IControl[];
sbOut.Append("<ul>");
sbOut.Append("<li>");
sbOut.Append( this.Page.Controls.Count );
sbOut.Append("</li>");
for (int iLoop = 0; iLoop < controls.Length; iLoop++)
{
IControl ctrl = (IControl)controls[iLoop];
string sName = ((IControl)ctrl).displayName;
string sGroupName = ((IControl)ctrl).GroupName;
// If the control is part of a group for the control
if (ctrl.GroupName != "" &&
(this.groupNames.IndexOf(ctrl.GroupName) > -1))
{
sbOut.Append("<li>Header : ");
sbOut.Append(ctrl.displayName);
sbOut.Append("</li>");
}
}
sbOut.Append("</ul>");
//lblOut.Text = sbOut.ToString();
return sbOut.ToString();
My problem is that it can ONLY see controls that appear BEFORE it in
the page.
Does anyone know how I might get around this?