比较网格单元中的值 [英] comparing values in gridcell

查看:92
本文介绍了比较网格单元中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...早安


我有一个网格视图,其中包含诸如from(定义项目指定日期)和to(定义项目完成日期)...的列.From和To是数字....

我的要求是from应该小于to,即,如果from是1 to应该大于1..

当我从值输入到下一行时,应该大于到上一行中的

从到
---- ----
1 2
3 4
像这样...
在开发窗口应用程序时,我希望在c#

Hi...Good Day


i have a grid view with columns like from(defines the project asigned day)and to(defines project completion date)...From and To are Numerics....

My requirement is from should be less than to i.e.,if from is 1 to should be >1..

and when i enter to next row from value should be greater than to in previous row

from to
---- ----
1 2
3 4
like this...
as i am developing window app i want this code in c#

推荐答案

中使用此代码.如果要添加数据,则将有所帮助.
Go through this logic. If you are adding data then this will help.
DataTable table = new DataTable();
     table.Columns.Add("From", typeof(int));
     table.Columns.Add("To", typeof(int));
     for (int i = 1; i < 10; i++)
     {
         table.Rows.Add(i, i + 1);
         i++;
     }

     GridView1.DataSource = table;



如果您要从数据库中获取数据,请详细说明.



If you are getting data from database then please elaborate some more.


这篇关于比较网格单元中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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