P
phl
hi,
I have a number of usercontrols which inherits a interface. the
function in this interface is used to provide information about the
usercontrol. I would like to call this function say when a button is
clicked.
I can do this by lot of hardcoding, as I have the usercontrol names
stored and I can call this obligatory function like this:
//loop through list of usercontorls
foreach(BLL.TicketInfo ti in TicketInfo)
{
if(ti.UserControlName.ToLower() == "EditProfile.ascx".ToLower())
{
EditProfile uc = (EditProfile)CurPage.FindControl("EditProfile");
dv.AddRange(uc.GetDisabledValidators());
}
//etc
}
while this works, it's crap because it makes adding usercontrols to my
app inconvienientm as I have to add hardcoded stuff everywhere. Just
wondering if you guys knows of a smarter way of doing this, like
dynamically. If I somehow loaded the usercontorl with the string I
have, should I be able query the function it supports by the interface
it's has inherited?
Cheers
I have a number of usercontrols which inherits a interface. the
function in this interface is used to provide information about the
usercontrol. I would like to call this function say when a button is
clicked.
I can do this by lot of hardcoding, as I have the usercontrol names
stored and I can call this obligatory function like this:
//loop through list of usercontorls
foreach(BLL.TicketInfo ti in TicketInfo)
{
if(ti.UserControlName.ToLower() == "EditProfile.ascx".ToLower())
{
EditProfile uc = (EditProfile)CurPage.FindControl("EditProfile");
dv.AddRange(uc.GetDisabledValidators());
}
//etc
}
while this works, it's crap because it makes adding usercontrols to my
app inconvienientm as I have to add hardcoded stuff everywhere. Just
wondering if you guys knows of a smarter way of doing this, like
dynamically. If I somehow loaded the usercontorl with the string I
have, should I be able query the function it supports by the interface
it's has inherited?
Cheers