如何使用C#比较ASP.NET中的文本框控件和gridview行索引 [英] how to compare textbox control and gridview row index in asp.net with c#
本文介绍了如何使用C#比较ASP.NET中的文本框控件和gridview行索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是阿尼尔,我想比较文本框控件和gridview行索引:
说明:在文本框中有一个字符串,例如anil,在文本框中控件的名称是anil:在gridview的行索引中同名anil,所以我想将其与...进行比较.
有什么办法....
问候,
Anilkumar.
Hi this is anil i want to compare textbox control and gridview row index:
Explanation:In textbox one string is there example anil,inside textbox control the name is anil:In gridview in row index same name anil so i want to compare this to...
is there any way....
Regards,
Anilkumar.
推荐答案
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow item in GridView1.Rows)
{
//Use the proper column index
int colindex = 0;
if (item.Cells[colindex].Text.Equals(TextBox1.Text, StringComparison.OrdinalIgnoreCase))
{
//Add your logic here
}
}
}
这篇关于如何使用C#比较ASP.NET中的文本框控件和gridview行索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文