I am attempting to create a 'find on page' search option for a wp7 webbrowser control named 'TheBrowser' (using the standard webbrowser control in Visual Studio). I have done a lot of research but have not found much in the way of an example or sample where this was implemented. Essentially I will just be activating the search on a click event, from a textbox where the user may type in a word to search in the current webpage. I would also like to highlight the matched words as seen when doing a find on page search on a desktop browser.
I believe that to create this 'find on page' option I should use javascript to search through the lines of text, and then somehow highlight matched words. I have already implemented forward, back, and refresh buttons using TheBrowser.InvokeScript, but I do not know how to format for searching through the entire webpage (I have never done anything like this before). Any advice or assistance would be greatly appreciated, including code samples as I am completely new to this subject! Thanks in advance for your help and hard work!
Try jquery, this should do the trick: http://hugoware.net/blog/more-jquery-magic-search-highlighting You'll just need to inject the jquery script into the page.
Related
I am coding a Windows Forms Application in C#, and one of the requirements is to display some html code in a control, with the correct colors that correspond to the relevant tags.
E.g. When right clicking on a webpage in Google Chrome, then selecting View Page Source, a form is shown with all the html, correctly formatted, with tag colors and each line of code's line number.
Is there a free, reliable control that can do this? Is there an inbuilt Microsoft control that does this?
As I am new to this area of coding, can someone please provide me with some useful names, and some resource links if possible? I am not sure of the correct name for a control that does this, and as such, my Google searches have not come up with what I am looking for.
Also, the control needs to be trustworthy.
Thanks
You can try ScintillaNET control. It's open source and has HTML syntax highlighting as well as many other features.
I'm displaying a website in a C# WebBrowser. But I would like to display only the search part not the whole website so it won't bo so big on the screen. This is the website http://www.buscacep.correios.com.br/ and I would like to display only the Busca CEP - Endereço Box. Any ideas of how I can do this? I tryed to use htmlagilitypack but it has very little documentation and I couldn't understand it.
The WebBrowser control isn't really designed for what you're asking. You probably could go through all the page elements and remove anything that isn't part of the search box, but that's a lot of work for very little value.
However, there's a bright side. As mentioned in a comment, you should be able to POST directly to the search page. Use a program like Fiddler to find out what form values are being passed to the server with the request. Then you can re-create that request from your own application (using a WebClient or HttpClient). The result will be HTML, which you can display in your WebBrowser by setting the returned HTML to the WebBrowser's DocumentText property.
Kindly let me know how can i implement the search functionality on a gridview the one same like in report viewer control that takes you to the searched text.
I have searched a lot , but no luck.
Any suggestion is welcome.Just need to be pointed in the correct direction.
UPDATE
Also i just had a quick idea looking at the browsers search , example: press ctrl+f and the browsers find tab appears, works the exact way i want it to . Can i force it to appears on the page, when using the website? OR implement it in the code something like that?
Thank you
Take a look at the link for quick start :
http://evonet.com.au/gridview-with-highlighted-search-results/
You can also see the following link:
http://www.codeproject.com/Articles/43018/ASP-NET-GridView-with-search-option-SearchableGrid
Thanks.
The best solution i can think of so far is to run the browser search functionality , CTRL +F .And the search in there works best like a report viewer control going into the gridview and finding out the information for me. To me it suited best for my requirements.Still interested to know of any other solution.
I've a very specific question:
How can I click in certain buttons on a web page?
Without that thing of coordinates. =D
What I really want, is a script that search for a Button (or more) with specific name and clicks it.
Imagine:
You open your browser and go to google page, than you run the script and, for example, it clicks the Search button.
If possible, I want a answer wich uses java or C#.
Thanks in advance for reading this,
and sorry for my bad english.
Edit:
Ok. Assuming that I'll use WatiN, can you rapidly explain how do I "put" this on my c# prog?
I want WatiN to be running on a button_click event. Like: When you enter the URL on my prog and press "OK" the prog will click that especific button that I've told you before.
Sorry if I've messed it up, I'me a truly noob with great ideas =s
For .NET, WatiN will do what you want. In fact, the very first example on the home page, shows you how to search google.
I WatiN all the time for screen scraping web sites: http://watin.sourceforge.net/
So i created a web site a long time ago using a designer alot like frontpage + expression design put together, and since then Ive gotten more into coding, and I'm learning html, CSS, and all that good stuff.. and i have this re-designed header that Ive made here:
http://prntscr.com/8zct
So what I need to know, is how i can get it so that when a user clicks on one of the links in the header design it will redirect to a page. and also if possible, how to make it so when a user hovers over a link a drop down may appear with other options, EDIT: I'd like to be able to add a backround image to the drop down navigation menu
As me being quite new to this sort of stuff, could anybody help me achieve this?
PS. I'm working in Visual Studio with ASP. but that doesn't change anything about the html and css stuff. just letting you guys know.
To navigate based on clicks on certain areas of an image, read about image maps.
To create menus and other active components, read about JavaScript (also recommended: jQuery).
You can also create divs that are clickable to use as hot spots on an image. that way you could add a background image to that div if ti's hovered/clicked, whereas image maps does not afford you that opportunity.