使用 HTML 或 C# 更改 GridView 中的列名 [英] Changing the column name in GridView using HTML or C#

查看:34
本文介绍了使用 HTML 或 C# 更改 GridView 中的列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重点是我在我的项目中使用了 GridView.我已经使用 SQLConnSQlDataAdapterDataSet

The point is I have used GridView in my project. And I have assigned the Values to GridView using the SQLConn, SQlDataAdapter and DataSet

GridView1.DataSource=ds;
GridView1.DataBind();

关键是输出显示了对最终用户不友好的表的列名.

The point is that the output shows the column name of the tables which is unfriendly for end users.

我该如何更改?

推荐答案

使用自己的GridView列,可以指定gridview的Header文本.转到 GridView 的属性--> 列--> 添加列并将 DataBound 设置为 DB 列名称和标题文本属性.

Use your own column of GridView and can assign the Header text of the gridview. Go to Properties of the GridView-->Columns-->Add the column and set the DataBound to the DB Column name and Header Text Property.

并且不要忘记将网格视图的 AutoGeneratedColumns 属性设置为 false

And Dont forget to set the AutoGeneratedColumns property to false of the gridview

这篇关于使用 HTML 或 C# 更改 GridView 中的列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆