What I am trying to achive is to dynamically set some properties at runtime in the current context of the app. Eg:
Let's say I am running a web page and inside the page load event, I would like to dynamically set a property of a control - property which I have it stored in the db or external resource.
I've tried using reflection but it doesn't work as I should point to an existing object on compile time, not runtime. Code example:
string propertyName = "RadTabStrip1.Tabs";
Type t = typeof(RadTab);
t.InvokeMember("Text", BindingFlags.SetField | BindingFlags.SetProperty, null, propertyName, new object[] { 0, "Bla Bla" });
Is there a way to achieve this by using either reflection, codedome or LINQ expressions?
Aucun commentaire:
Enregistrer un commentaire