views:

335

answers:

1

If I have a control, within a FormView, that is bound using a <% #Bind(...)%> expression. At run time, is there any way of retrieving the name of the field the control is bound to.

To be clear, if the expression is <% #Bind("UserName") %> I want to return the string "UserName".

+1  A: 

after messing around extensively in debug, I found this to work

((System.Web.UI.WebControls.AutoGeneratedField)((System.Web.UI.WebControls.DataControlFieldCell)(e.Row.Cells[0])).ContainingField).SortExpression

In debug use shift+F9 to open the quick watch window pain and explore your Event Argument visually

WebDude