How do you access the Boundfield object?
I have OnDataBinding="MyFunction" on the aspx and then in the code behind I have protected void MyFunction(object sender, Gridview e). I can't locate the Boundfield object. I can access the first column throught e.Column[1] but I'm interested in 开发者_开发百科the DataFormatString property and that's a property of the Boundfield object.
thanks.
If you for example want to show the time only(and your 2. column is a Date-Column):
VB.Net
DirectCast(Me.GridView1.Columns(1), BoundField).DataFormatString = "{0:t}"
C#
((BoundField)(this.GridView1.Columns[1])).DataFormatString = "{0:t}";
精彩评论