Finding ColumnName from databound controls

S

sunss

Given a webform control, such as a textbox, I'd like to find out what
underlying column the control is bound to. After much searching
around I haven't come close to a solution yet for asp.net, although in
a winform its fairly simply achieved like so:

MyTextBox.DataBindings(0).BindingMemberInfo.BindingField.ToString()

I'm trying to perform a simple loop against a collection of bound
controls and set the 'tooltip' of each control to be the bound column
name.

The closest I've come is declaratively against the control itself,
although this requires me to already know the column name/index!

CType(Container.DataItem,
System.Data.DataRowView).DataView.Table.Columns(0).ColumnName

Is there an equivalent to DataBindings in asp.net, or is it just not
as clever as winforms?

Any assistance gratefully received!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top