We have 100 records in gridview and we want to select 90th record. But user is not interested to scroll through mouse and see that record.
I have one textbox and button if i enter the column value the particular row will be scroll and highlighted this is my Source code
protected void Button1_Click(object sender, EventArgs e)
{
String searchTerm = TextBox3.Text;
//if the column index is 1 the we search by code and 2 if we search by name
int columnIndex = 1;
bool found = false;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
//change background color to yellow for the rows that contain the searched value
if (GridView1.Rows[i].Cells[columnIndex].Text.ToString().StartsWith(searchTerm))
{
if (searchTerm != "")
{
GridView1.Rows[i].BackColor = Color.SkyBlue;
}
else
{
GridView1.Visible = true;
GridView1.Rows[0].BackColor = Color.SkyBlue;
}
}
Thank you,
Loading

Vincent Maverick DuranoRank #238 · 10.3K reputationPosted May 15, 2015, 5:34 AM EDT
DEMO: http://aspsnippets.com/demos/685/
Dipankar BiswasRank #992 · 2K reputationPosted May 15, 2015, 5:39 AM EDT
Check this example..http://www.c-sharpcorner.com/UploadFile/rohatash/how-to-get-the-selected-row-in-gridview-using-Asp-Net/
Nanhe SiddiqueRank #1,103 · 1.7K reputationPosted May 15, 2015, 8:39 PM EDT
on gridview selected index changed event write following code