473,626 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Highlight search text in iframe in asp.net

68 New Member
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 6827
Frinavale
9,735 Recognized Expert Moderator Expert
Have you considered using JavaScript to solve this problem?


-Frinny
Jun 16 '09 #2
sangam56
68 New Member
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.WriteF ile 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 Recognized Expert Moderator Expert
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 Recognized Expert Moderator MVP
To get access to the iframe document, there are one or two differences: contentDocument says W3C and the standards-compliant browsers, and contentWindow.d ocument 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
5013
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 scripts" and haven't got one to work yet. I'm looking for straightforward understandable way to do this on my MYSQL/PHP pages. Thanks, Lee
13
4525
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 = RegEx.Replace(vSearch, "<span class=""Highlight"">" & vFind &
3
4342
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 impossible to use <textarea> and Modeless dialog. I am really stuck!!! Is there any trick to make <DIV> or <SPAN>'s content be selectable in a Modal dialog? Thanks in advance,
3
3253
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 words in the iframe. Does anyone know how to do this? By JS or VBScript? Thanks
1
2966
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
2060
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 columns. According to this parameter, the dataset and datagrid shows only the columns where the search parameter applies. The code is
2
2918
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? Please take a look at my code and tell me what i'm doing wrong: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>highlight</title>
0
6838
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 within your record return page : 'Highlight searched for text function Function Highlight(strText, strFind, strBefore, strAfter) Dim nPos Dim nLen
3
3392
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 i highlight it is possible? pls guide me Example Content : "The previous installments in this article series have demonstrated how to display, group, sort, and page through data using the ListView control. In addition to displaying data, the...
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.