开发者

gridview boundfield

开发者 https://www.devze.com 2023-02-04 15:09 出处:网络
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 B

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}";
0

精彩评论

暂无评论...
验证码 换一张
取 消