gpt4 book ai didi

asp.net - 在 rowdatabound 事件中获取列标题文本

转载 作者:行者123 更新时间:2023-12-02 08:37:17 25 4
gpt4 key购买 nike

我需要在 GridView 的 rowdatabound 事件的 DataControlRowType.Data 中获取列标题,我是这样做的:

((DataTable)((GridView)sender).DataSource).Columns[i].ColumnName

还有其他的,可能比上面显示的更简洁吗?只是想看看这里。

最佳答案

if (e.Row.RowType == DataControlRowType.Header) { 
LinkButton LnkHeaderText = e.Row.Cells[1].Controls[0] as LinkButton;
LnkHeaderText.Text = "Name";
}

关于asp.net - 在 rowdatabound 事件中获取列标题文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20136911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com