Click here to Skip to main content
15,890,408 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
enter value in textbox and click on the search button, then we display the matched row as highlighting and we alsoshow the remaining rows??
Posted
Updated 16-Jun-11 23:24pm
v2
Comments
Sandeep Mewara 17-Jun-11 5:29am    
Ok. And what have you tried so far?

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[^]
 
Share this answer
 
v2
on button click event try this code its help u.
C#
string name = TextBox2.Text;

       bool recordFound = false;

       foreach (GridViewRow gvr in GridView1.Rows)
       {
           Label lbllogin1 = gvr.FindControl("lbllogin") as Label;

           if (name == lbllogin1.Text)
           {
               recordFound = true;
               gvr.BackColor = System.Drawing.Color.BlanchedAlmond;
               break;
           }
       }
       if (recordFound)
       {
           Label1.Text = "Record found";

       }
       else
       {
           Label1.Text = "Record not found,Please enter correct name";
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900