0

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".

4

1 回答 1

1

在调试中大量搞乱之后,我发现这是可行的

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

在调试中使用 shift+F9 打开快速观察窗口痛苦并直观地探索您的事件参数

于 2008-10-10T11:13:42.537 回答