如何在运行时在gridview中添加模板列 [英] how to add template column in gridview at runtime

查看:67
本文介绍了如何在运行时在gridview中添加模板列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想添加运行时模板列请帮助我

谢谢你

Hi,
I want to add runtime template column pls help me
thank u

推荐答案

讨论同样的


TemplateField tf = new TemplateField();

tf.HeaderText =NewTemplate column;

MyTemplate template = new MyTemplate (test);

tf.ItemTemplate = template;

GridView1.Columns.Clear();

GridView1.Columns.Add( tf);



string [] s = {as,34,z,@#4,666};

GridView1.DataSource = s;

GridView1.DataBind();
TemplateField tf = new TemplateField();
tf.HeaderText = "NewTemplate column";
MyTemplate template = new MyTemplate("test");
tf.ItemTemplate = template;
GridView1.Columns.Clear();
GridView1.Columns.Add(tf);

string[] s = { "as", "34", "z", "@#4", "666" };
GridView1.DataSource = s;
GridView1.DataBind();


这篇关于如何在运行时在gridview中添加模板列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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