Click here to Skip to main content
15,898,769 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a problem, I'd like to get all the values from db and view it all in a Gridview. Once I get the data, I'd like to match the value in the textbox to all rows in gridview/db. Then put the result to the new column in the same/other gridview


ex.

TextBox1.Text = Hello Everyone! I'm your.. ; 


I only want to know how to match the text in here while using a simple string match in c#


RowId   |   Sentence                |    Percntg Match (newly added column)
  1     |  Hello there! I'm...      |      0.103453
  2     |  Hi there! My name..      |      0.237657
  3     |  Hey dude! How are ...    |      0.15342


I hope you understand what I result I want to get
Posted
Comments
Vedat Ozan Oner 24-Feb-14 7:02am    
At what point did you get stuck?
Dev Jonie 24-Feb-14 7:26am    
in the part of , using the each rows of "Sentence" to be compared in the my c# codes in textbox value and put the results in newly added column in another/same gridview
Vedat Ozan Oner 24-Feb-14 7:56am    
If you put some code into your question related to the point where you stuck, help will come faster possibly.
ZurdoDev 24-Feb-14 10:34am    
I don't understand where you are stuck.
Dev Jonie 25-Feb-14 23:16pm    
I'm stuck at creating a new column from the c# code to the gridview w/ values from a query

1 solution

After getting data from database,Add another column in result data set which
will hold your operation result. before binding to grid ,process it as you want (ie. check particular column value match with text box text) & update result in newly added column. After finishing it bind it to grid.

Or

Use row data bound event of grid. Bind your data set as it is to grid.In row data bound event .Process each grid row for your check condition & update result column in Grid view.

For row databound , check this link
 
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