How do I find the associated the field and table bound to a control in C#?
I'm generating some code from a form object using reflection. I want to iterate through all the controls on the form and output the field and table that each control is bound to. Right now, I am 开发者_如何学Cable to output the databound field for a control:
if ((control is Label) || (control is TextBox)) {
if (control.DataBindings["Text"] != null) {
field = GetFieldDisplayName(control.DataBindings["Text"].BindingMemberInfo.BindingField);
}
}
Getting the field is useless for me if I can't find its associated table programmatically.
精彩评论