.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

how to highlight the search word result

Posted By: atika     Posted Date: April 20, 2010    Points:2   Category :ASP.Net
This question is based on my project: Thesis ManagementSystem..
In my project using VB in ASP .NET, I have a searching function. When the user enter the keyword like "Shift-OR" then i will show all the Thesis ID which is content the shift-or keyword in it.. So, user can click on the ID to go to the other page(ResultPage.aspx) which will display the content of the thesis related to the search keyword.

My problem now is, i don't know how to highlight the keyword in the new page because most of the example that I found at the Internet using gridview.. but in my case, I'm only use the label.

Hopefully to hear from u..
Thank you

Author: Venkat             
Posted Date: April 20, 2010     Points: 5   


If I understood you correctly you can search a keyword from SQL Server and if the result matches than you have to pull the whole records and in that Paragraph you need to highlight the keyword. Is that correct?

If yes than do like this

Use full text search functionality of sql server to search the keyword and get the record from database.

Once you get the record from database use String.IndexOf("") method to find the keyword position in the record.

Once you get the position of the keyword from a record use string.Replace("","") to and use <font> tag to
highlight the keyword.

and yes do not use label use asp.net litral control to display paragraph with highlighted text. because using Label control you can not highlight the particular text, word or keyword.

Hope this will help you

Mark As Answer if this solve your problem
Warm Regards,
Author: jason             
Posted Date: August 03, 2010     Points: 5   

I suggest to use a .net word component name Spire.Doc, I use it long time, quit good.

May help to you.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend