将网格文本框值与下一行网格文本框值进行比较 [英] compare grid textbox value with next row grid textbox value

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

问题描述

大家好,


页面加载时,我使用动态Gridview创建行.有一个按钮可以在网格上动态添加新行.

我想这样做如何将每行文本框"值与下一个文本框值进行比较.我不会在下一行中添加相同的文本框"值.

所以,我该怎么做?

我使用模板字段来绑定数据.

请帮我解决这个问题.........

谢谢和问候...
Mitesh

Hello To All,


I use the Dynamic Gridview to create Row when page load. there is a button to add new row on grid dynamically.

i want to do that "How to compare the Each Row Textbox value with the next textbox value. I do not add the same Textbox value in next Row.

so, how can i do this ?

i use Template FIeld for binding the Data.

Please help me to solve out this.........

Thanks and Regards...
Mitesh

推荐答案

要访问gridview内的文本框,请使用
如果(
((TextBox)(gridview1.Rows(0).Cells [2] .FindControl("textboxid1"))).Text ==
((TextBox)(gridview1.Rows(0).Cells [2] .FindControl("textboxid2"))).Text;)

记住:要访问动态创建的网格视图,您应该在访问网格之前再次加载网格
To access textbox inside gridview use
if(
((TextBox)(gridview1.Rows(0).Cells[2].FindControl("textboxid1"))).Text==
((TextBox)(gridview1.Rows(0).Cells[2].FindControl("textboxid2"))).Text;)

Remember: To access dynamically created gridview you should load the grid once again before accesing it


然后
修改为
((TextBox)(gridview1.Rows(0).Cells [2] .FindControl("textboxid1"))).Text ==
((TextBox)(gridview1.Rows(1).Cells [2] .FindControl("textboxid1"))).Text;)

我的意思是说比较成功的行...
then
modify it as
((TextBox)(gridview1.Rows(0).Cells[2].FindControl("textboxid1"))).Text==
((TextBox)(gridview1.Rows(1).Cells[2].FindControl("textboxid1"))).Text;)

i mean to say compare for succesive rows...


这篇关于将网格文本框值与下一行网格文本框值进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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