473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Search in datagridview for closest match c sharp

Hello Guyz.. I want to search a name in datagridview for closest match in c sharp. For Example I type 'A' in textbox and it should get all names with starting letter 'A' from datagridview coloumn Name, similarly as I type AD it shuold get all names with starting letter 'AD'....
I hope you get my question..
Apr 25 '11 #1
1 3020
This may help you...
Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2.     {
  3.         for (int j = 0; j < GridView1.Rows.Count; j++)
  4.         {
  5.  
  6.             string s = GridView1.Rows[j].Cells[1].Text;
  7.             s = s.ToLower();
  8.          // for(int n=0;n < s.Length-1; n++)
  9.           //{
  10.             if(s.StartsWith(TextBox1.Text.ToString())==true)
  11.             {
  12.                 Response.Write(GridView1.Rows[j].Cells[1].Text );
  13.             }
  14.          //}
  15.         }
  16.     }
Apr 27 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Daniel Pryde | last post by:
Hi everyone. I was wondering if anyone might be able to help me out here. I'm currently looking to find the quickest way to find a best fit match in a large array. My problem is that I have an...
6
by: cybit friendly | last post by:
Hi I'm stuck due to lack of knowledge. Problem: I'm scanning through Array1 to find the closest match to Array2 within Array1. At the moment I'm using a method that can best be described as...
0
by: Xah Lee | last post by:
in the regex module re: Note: Match() is not exactly equivalent to Search() with "^". For example: re.search(r'^B', 'A\nB',re.M) # succeeds re.match(r'B', 'A\nB',re.M) # fails if without...
13
by: mike | last post by:
I have ListArray with number in Eg: 1, 1.456, 2.43, 4, 6.78 next i have a decimal variable containing one number EG: 1.786 Could someone please tell me how i find the "closest match" number...
2
by: Daniel Di Vita | last post by:
I have created an ASP.NET page that allows the user to page through a result set. I need to expand on this. On that same page I a filed where the user can type in a search string. When they click...
2
by: Daniel Di Vita | last post by:
I have created an ASP.NET using page that allows the user to page through a result set. I need to expand on this. On that same page I have a field where the user can type in a search string. When...
1
by: Lance Hoffmeyer | last post by:
Hey all, I have a search: VAR = re.search("PROVEN.*?\n+\d(.*?)\n.*?" , pcpT9, re.S ).group(1) #.split() that does not match (sometimes it will and sometimes it will not match) Traceback...
1
by: CatherineA | last post by:
I need help writing an SQL statement in Access 2007 to select the closest date/time. I have Spot Time (the date/time commercials ran) and Call Time (the date/time we received calls). I need to...
9
by: weirdguy | last post by:
Hello, Just for anyone information, there is a similar title "Search in Listbox" but it is via Combo Box. In case, anyone need it, I put a link to here. Please let me know if I break any rules...
0
by: Chris Philpott | last post by:
I search my form using the RecordSource which works really well until there's no match for the criteria (created between cboSearchField and txtSearchString). If there's no match I get a completely...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.