高照明GridView行? [英] High lighting gridview row?
本文介绍了高照明GridView行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在文本框中输入值,然后单击搜索按钮,然后将匹配的行突出显示,同时还显示剩余的行?
enter value in textbox and click on the search button, then we display the matched row as highlighting and we alsoshow the remaining rows??
推荐答案
简单的逻辑是创建CSS的CSS仅将CSS应用于匹配的行.您的问题将得到解决.
看到该链接如果列满足条件,则在Gridview中突出显示行 [
simple logic is that create a CSS amd apply that CSS only on the matched row. your problem will be solved.
see that link Highlight row in Gridview if column meets condition[^]
按钮单击事件,请尝试使用此代码提供帮助.
on button click event try this code its help u.
<pre lang="cs">string name = TextBox2.Text;<br />
<br />
bool recordFound = false;<br />
<br />
foreach (GridViewRow gvr in GridView1.Rows)<br />
{<br />
Label lbllogin1 = gvr.FindControl("lbllogin") as Label;<br />
<br />
if (name == lbllogin1.Text)<br />
{<br />
recordFound = true;<br />
gvr.BackColor = System.Drawing.Color.BlanchedAlmond;<br />
break;<br />
}<br />
}<br />
if (recordFound)<br />
{<br />
Label1.Text = "Record found";<br />
<br />
}<br />
else<br />
{<br />
Label1.Text = "Record not found,Please enter correct name";<br />
}</pre><br />
看看:
http://social.msdn.microsoft.com/论坛/en-US/winformsdatacontrols/thread/2f82750c-35fd-4cec-adc7-83204283d222 [ http://www.dotnetcurry.com/ShowArticle.aspx?ID=123 [ ^ ]
http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=76 [ ^ ]
希望对您有所帮助,请让我知道.
Have a look:
http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/2f82750c-35fd-4cec-adc7-83204283d222[^]
http://www.dotnetcurry.com/ShowArticle.aspx?ID=123[^]
http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=76[^]
Hope will help,if you have more concern let me know.
这篇关于高照明GridView行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文