hello, i have somme troubles with the reflection mechanism. i try to invoke a label control through the InvokeMember method to set the Text property with the correspondance entry in my resources. my problem is that in the code behind the label control is declared
but never defined. i can create a new instance but that is not what i really want. here some sample code. //aspx code behind public class UiPage:System.Web.Ui.Page{ private Page_Load(...){ //call method to set Text property UtilClass util = new UtilClass();
util.SetLabelProp(this, resource); } protected System.Web.UI.WebControls.Label label; } public class UtilClass{ public void SetPropLabel(object obj, ResourceManager res){ //get all fields and check for the type we need ... //invoke member and set property
fieldInfo[i].FieldType.InvokeMember("Text", ..., new object[]{res.GetString(...)}); } } how can i get the reference for the label object?
Phuong-Nam
Member
65 Points
13 Posts
Reflection
Nov 04, 2003 01:21 PM|LINK