473,385 Members | 1,934 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,385 software developers and data experts.

Highlight search text in iframe in asp.net

Hi all.
I have an iframe in an asp.net web page (Display.aspx).

Expand|Select|Wrap|Line Numbers
  1. <iframe id="iframe1" runat="server" src="temp/test.html"></iframe>
Now I need to highlight a search text, say 'test' in the Display.aspx page. The source of iframe is dynamically assigned and search text is also changeable. This means I am dealing with dynamic search text and html page. Please suggest me how could I highlight the search texts in the iframe placed in the asp.net web page.

Thanks in advance. Happy Programming!
Jun 16 '09 #1
4 6809
Frinavale
9,735 Expert Mod 8TB
Have you considered using JavaScript to solve this problem?


-Frinny
Jun 16 '09 #2
Hi,
I have used jquery highlighter. It is highlighting the words in the aspx page. But I am unable to highlight the search words within the html files embedded in the aspx page.

We can embed an html file into an aspx page in various ways, using Response.WriteFile or Server.Transfer or using iframe also. In all these methods, I have been unable to highlight the words in the html file. Any idea please? Thank you.
Jun 17 '09 #3
Dormilich
8,658 Expert Mod 8TB
if the text to be highlighted is in the iframe, it could be that the Javascript is not loaded or the text not accessed. Frames (resp. their content) in any way are separate HTML pages! (though there are ways for Javascript to interact between pages)

since asp is executed on the server (right?) this reduces to a frame-javascript problem.

PS: I gave up on frames long ago, so you might have to ask in the Javascript forum for the appropriate solution
Jun 17 '09 #4
acoder
16,027 Expert Mod 8TB
To get access to the iframe document, there are one or two differences: contentDocument says W3C and the standards-compliant browsers, and contentWindow.document according to IE. So, try something like this:
Expand|Select|Wrap|Line Numbers
  1. if (iframeObj.contentDocument) doc = iframeObj.contentDocument;
  2. else if (iframeObj.contentWindow) doc = iframeObj.contentWindow.document;
Jun 19 '09 #5

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

Similar topics

5
by: leegold2 | last post by:
Commonly done, eg. you enter a word in a search engine and when a hit-page comes up the search word(s) are highlighted. I'm doing a fulltext search that works well but I've tried a few "packaged...
13
by: David Morgan | last post by:
Hello I have a little function to highlight text if it exists. Function Highlight(vFind, vSearch) Dim RegEx Set RegEx = New RegExp RegEx.Pattern = vFind RegEx.IgnoreCase = True Highlight =...
3
by: tungchau81 | last post by:
Hi, A Modal Dialog does not allow us to highlight the text content inside <DIV> tag unless I use a <textarea> tag to display that text content. However, the situation of my software makes it...
3
by: Nicky | last post by:
hi, all I have an iframe in my page. Actually what I want is just like the google search. When user clicks search, I will load the a page from another URL into iframe and then highlight the key...
1
by: hrpreet | last post by:
Hi All, On click of a link , the contents get displayed in an iframe. Is there a way to search some text in the content displayed in the iframe and highlight it. Thanks.
0
by: Savvas | last post by:
Hi, I am using VB.Net 2005 for a windows application. The application was actually upgraded from vb.net 2003. I have a search field which is used as a parameter to search all datagrid...
2
by: Celeste | last post by:
Hello, I'm trying to parse the referring url for google search terms so that when this page loads it will scroll to and highlight the search term(s). Should i be using document.referrer? ...
0
Merlin1857
by: Merlin1857 | last post by:
A thing I have been asked for on a number of occasions is the ability to highlight text after its been searched for in a record return page. The following does this perfectly. Use this function...
3
by: yogarajan | last post by:
Dear Friends i am devloping for search box it is woking good i want highlight my search text. My original text is Mixed case (Lower case and upper case) my search text is lower case means how can...
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.