Q:

Avoid "magic strings" in databound web controls? 

Is there a way to bind data to controls using the properties being bound to them so re-factoring and typos aren't so much of an issue? 
For example, instead of assigning field names to a drop-down list like ddl. DataTextField = "FieldName"; ddl. DataValueField = "Id", I would hypothetically write ddl. DataTextField = MyClass. FieldName; ddl. DataValueField = MyClass. Id;. 
Edit:
I'm thinking about having my objects implement an interface that has DataTextField and DataValueField (or similarly named) properties so, at the very least, my DDLs would be consistently bound. 
This wouldn't help in the case of ListViews, GridViews, etc.  though. 

A:

I am not sure if this is what you are thinking, but maybe it will help out. 
private void PopulateDropDown( List<MyClass> myClassList )
{
    // Loop through myClassList. 
    foreach ( MyClass m in myClassList )
    {
        // Add myClass to the drop down list. 
        ListItem item = new ListItem( m.FieldName, m.Id.ToString() );
        ddl. Items. Add( item );
    }
}

