如何在ASP.NET中动态添加gridview列 [英] How can I add gridview column dynamically in ASP.NET

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

问题描述

我想通过点击按钮动态添加列



我尝试过:



我已经通过点击一个按钮添加了行但我想用相同的颜色添加列

I want to add column dynamically by clicking a button

What I have tried:

I have added rows by clicking a button but i want to add column by the same

推荐答案

我能想到的一个最简单的解决方案是,将GridView的autogenrate列设置为true并将新列添加到数据源并重新绑定网格。









您可以为此目的考虑jQuery。
One easiest solution i can think of is, set autogenrate column of GridView to true and add new columns to your datasource and rebind the grid.


Or

You can think of jQuery for this purpose.


('#yourGridId')。find('tr')。each( function()

{
('#yourGridId').find('tr').each(function()
{


(this).append(
(this).append(


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

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