Gotcha.
Our FormView is far too customized to be useful to anyone else. We've got
all kinds of crap in there. But the part you might be interested in is a
very simple recursive routine that binds controls to our custom business
object. Here it is:
protected virtual void GenerateFieldBindings(Control containerControl)
{
// Loop through all controls and attempt to wire-up fields by matching
// the control ID to the field name.
foreach (Control c in containerControl.Controls)
{
if (c.ID != null)
foreach (IField f in BoundObject.Fields)
if (c.ID.ToUpper() == f.FieldName.ToUpper())
AddFieldBinding(c, f);
GenerateFieldBindings(c);
}
}
So, if you replace "BoundObject.Fields" with
"YourCollectionOfObjectsObtainedFromYourDB" you're pretty much set. Just
pass in a reference to your "page" to get the ball rolling (e.g. in the
Page_Load just call GenerateFieldBindings(this)).
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:E6**********************************@microsof t.com...
>I am building an application that is multilingual. The text elements are
stored in a database table and when the page loads, I get all the text
stuff
for the controls on that page (text, tooltip, messages for validators,
etc...) in the current user's language and then I go through each control
and
set the text property, tooltip property, what have you. To do this I have
created a special interface class that does the heavy lifting - reading
the
database, getting the properties, etc...
I'd be interested to hear more about that custom FormView if you've the
time.