Hi gang,
I am trying to access the controls on an .ascx via reflection, but cannot seem to figure out which of the "Get..." methods on the type to call to do it.
I have a page with a textbox called "txtFirstName" on it, and what I am trying to do is fill the textbox with data from a domain object. My code to access the textbox is:
Dim dispCompInfo As System.Reflection.FieldInfo
dispCompInfo = Me.GetType.GetField("txtFirstName", Reflection.BindingFlags.NonPublic | Reflection.bindingflags.Instance)
but it keeps coming up with nothing or I get an error that a message is being passed to an object that equals nothing. I have tried other Get... methods on Type, but none seem to yield the textbox. What am I doing wrong?
Also, once I get the textbox, do I need to get property info for the "Text" property in order to set a value in it, or is there some other more convenient/clever way to do that?
Thanks for any input!
Cheers,
Chris
--------------------------------
From: Christopher Burns
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>PoIr0gOUwUGSafD2noiB7w==</Id>