如何使用gridview中的选定列 [英] How to work with selected columns in gridview
本文介绍了如何使用gridview中的选定列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hi Geeks,
string [] items = {'56','68'};
我的Gridview:
样式 56 62 68 74 80
1 260 520 520 260 130
2 - 130 260 520 < span class =code-digit> 260
那么如何通过传递从第1行的56到68添加string [] items。
我的代码逻辑错误..
foreach ( string li in listitems)
{
items = li.Split('' - ');
while (dtfinals.Columns [items [k]]。ColumnName.ToString()!= items [items.Length-1])$ b $ b {
itemlists.Add(dtfinals.Columns [items [k]]。ColumnName.ToString());
k ++;
}
我的意思是,我只是通过56-68的范围,但它应该是56 + 62 + 68的值第1行,当我传递字符串[] items = 74-80时,它应该添加第1行的74-80(不是56-68),反之亦然。
解决方案
Hi Geeks,
string[] items={'56','68'};
My Gridview:
Style 56 62 68 74 80
1 260 520 520 260 130
2 - 130 260 520 260
So How to add from 56 to 68 of row 1 with passing string[] items.
My code which is logically wrong..
foreach (string li in listitems)
{
items = li.Split('-');
while(dtfinals.Columns[items[k]].ColumnName.ToString()!=items[items.Length-1])
{
itemlists.Add(dtfinals.Columns[items[k]].ColumnName.ToString());
k++;
}
I mean, I just pass the range like 56-68 but it should 56+62+68 values of row 1 and when I pass the string[] items = 74-80, it should add values from 74-80(not 56-68) of row 1 and vice versa for other rows.
解决方案
这篇关于如何使用gridview中的选定列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文