问题描述
- templatefield怎么设置显示效果像label一样 而不是text一样可被编辑
-
aspx文件中只有这样的代码SkinID="gridviewSkin"
AutoGenerateColumns="False"
EmptyDataText="对不起,没有相应数据!">
/asp:GridViewcs文件中的代码部分如下
TemplateField tf = new TemplateField();
tf.ShowHeader = true;
tf.HeaderTemplate = new GridViewTemplate(DataControlRowType.Header, "关井信息", "", (i + 1).ToString(), true, true);
tf.ItemTemplate = new GridViewTemplate(DataControlRowType.DataRow, infor, xxname, (i + 1).ToString(), true, true);
tf.HeaderStyle.Height = Unit.Percentage(100);
tf.HeaderStyle.Width = Unit.Pixel(60);
tf.ItemStyle.Width = Unit.Pixel(60);
gv.Columns.Add(tf);还有很多段类似的代码 设置显示不同的列。
显示出的效果如图所示:
图片在百度知道里才能看到
CSDN移动问答图片中的数据部分可以进行编辑甚至删除 该怎么设置能让它显示的像标签label一样
不能被编辑
注:本人新手 这是项目中本来写好的代码