Up vote 1 down vote favorite share g+ share fb share tw.
I have a CommonMaster page that then contains a ConfigurableReportsMaster page. I then have an AutitLog. Aspx page.
Now, on that . Aspx page I have multiple UserControls. Some of these UserControls are inheriting from an ISQLFilter interface, but not all.
While on the . Aspx, in a RunReport event (that currently successfully fires) I am manually calling a method of each UserControl (that is in the ISQLFilter interface) called .GetWhereClause(). This.ucsStateFilter.
GetWhereClause(ref sbWhere); this.ucsStatusFilter. GetWhereClause(ref sbWhere); this.ucsActivityType. GetWhereClause(ref sbWhere); this.ucsVendorFilter.
GetWhereClause(ref sbWhere); this. UcsProducerFilter. GetWhereClause(ref sbWhere); this.ucsNameFilter.
GetWhereClause(ref sbWhere); this.ucsPolicyFilter. GetWhereClause(ref sbWhere); this. UcsShowAddressInfo.
GetWhereClause(ref sbWhere); This works great and does exactly what I need. I would like though, for ease of use, is to just call one method, say GetAllWhereClauses() that would use Reflection to find all of the UserControls (that inherit the ISQLFilter interface. ) It sounds really simple and I have used reflection numerous times.
I would assume I could have just done: Type t = typeof(AuditLog); PropertyInfo pis = t.GetProperties(); But the UserControls are not there. I can look at this in the QuickWatch window and see each of my UserControls. I have tried a looping through each of the .
Controls sets from the Page and deeper and I can successfully get to controls that I have on the CommonMaster page. But that doesn't help me here. Perhaps I am thinking too much about it.
If it would help, can I just get a list of all of the " items? I suspect I am just missing one cast or something. Thanks in advance, Kevin c# reflection usercontrols master-pages nested link|improve this question asked Oct 29 '10 at 14:14Grandizer9619 67% accept rate.
If so, the raw t.GetProperties() will not work. You'll have to pass BindingFlags. NonPublic | BindingFlags.Instance.
– Kirk Woll Oct 29 '10 at 14:18 I tried that and it did not work. However, that got me further down the rabbit hole. I had to use .
GetFields instead: – Grandizer Oct 29 '10 at 16:55 However, I now see them, but I cannot do an fi is ISQLFilter or even fi is UserControlBase so I am somewhat stuck again. – Grandizer Oct 29 '10 at 16:56 OK - SUCCESS! Thank you Kirk.
The solution is using the . GetValue method. The code is as follows: foreach (FieldInfo fi in fis) if (fi.
GetValue(this) is ISQLFilter) // Do Something – Grandizer Oct 29 '10 at 17:02.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.