模板列中原来只有一个控件TextBox。
在ItemDataBound中,我
CType(e.Item.Cells(1).Controls(1), TextBox).Text = e.Item.Cells(4).Text.Trim()
这样没问题。但现在我在TextBox左边加了个Label,数据绑定为
CType(e.Item.Cells(1).Controls(1), Label).Text=e.Item.Cells(4).Text.Trim()
CType(e.Item.Cells(1).Controls(1), TextBox).Text = e.Item.Cells(4).Text.Trim()
这样就出错了。为什么?