Friday, October 08, 2010 9:59 AM kashyapa

WEbmatrix–helpers–Bing

WebMatrix Beta 2 was released on Oct 06 2010. Many changes to how WebMatrix used to work in some areas from Beta 1 to Beta 2.

Some changes went into to WebMatrix Helpers also. There are  4 new helpers that have been added to Helper family. They are :

- Antiforgery

- Bing

- Json

- Themes

In this post i am going to talk about “Bing” Helper. Because i was interested to known what this helper can do.

Bing as we all know is “Bing Is Not Google”. This is a search engine from Microsoft. Although it is getting itself positioned as not just an search engine but a decision making tool. So WbeMatrix Bing helper is to allow you to embed the Bing search box within your website.

Let me dive into the API. Bing helper can be found in the following assembly:

Microsoft.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Lets see the Bing helper methods available.

1. SearchBox

This method helps us to embed a simple search box on to the web page. The syntax is as follows:

IHtmlString SearchBox([Optional, DefaultParameterValue(null)] string siteUrl,

[Optional, DefaultParameterValue(0x142)] int boxWidth);

It takes in the following parameters:

- siteUrl – optional parameter. If provided will search the query only in that site.
                Default value is null

- boxWidth – optional parameter. Specifies the width of the search box on the 
                     page. It also has a default value so even if we don’t specify, the 
                     width comes with pre defined value of 322.

Following is the code in a razor webpage to get the Bing search box:

   1:  <div>
   2:     <p>Simple Search Box</p>
   3:     @Bing.SearchBox("http://weblogs.asp.net/kashyapa") 
   4:  </div>

As you can see i have passed the site url as “http://weblogs.asp.net/kashyapa”. So that means if i search for anything, it will search in that site only. I have not specified any width so its going to take the default value of 322.

Here is the out out of the above code:

image

The search box is neatly laid out even with the Bing search glass icon and look at the radio buttons below the search box. They even provide the option to search within the site specified or the whole web. Cool i say. So when i give a search query and hit the search, following is the search results displayed:

image

You can see that the searches are all done within the site specified while creating the search box.

2. AdvancedSearchBox

This method helps us to embed a advanced search box on to the web page. The syntax is as follows:

   1:  IHtmlString AdvancedSearchBox(
   2:  [Optional, DefaultParameterValue(null)] string siteUrl, 
   3:  [Optional, DefaultParameterValue(null)] string siteName, 
   4:  [Optional, DefaultParameterValue(0x142)] int boxWidth, 
   5:  [Optional, DefaultParameterValue(600)] int resultWidth, 
   6:  [Optional, DefaultParameterValue(400)] int resultHeight, 
   7:  [Optional, DefaultParameterValue("Blue")] string themeColor, 
   8:  [Optional, DefaultParameterValue("en-US")] string locale
   9:  )

So the advanced features of this method is that, i can specify more things than the SearchBox method. As you can see we have the following parameter options:

- siteUrl – optional, if provided the search will be done on this site

- siteName – optional, if provided will be used as caption for the search

- boxWidth – optional, if provided will be used to size the search box. default 
                      value is 322

- resultWidth – optional, if provided will be used to set the size of the result

- resultHeight – optional, if provided will be used to set the height of the result

-themeColor – optional, if provided will be used as a theme color for bing

-locale – optional, if provided the search will be localised to this locale

Here is the syntax for the same:

   1:  <div>
   2:              <p>Advanced Search Box</p>

3: @Bing.AdvancedSearchBox(
siteUrl:"http://weblogs.asp.net/kashyapa",

   4:               siteName:"Kashyapas .NET Rumbles",
   5:               boxWidth:400,resultWidth:400,resultHeight:400)
   6:  </div>

This method allows you to control the appearance of the search results too. With SearchBox the search results will be opened in a new window,

image

This is a very good helper if you plan to provide a search capability built into your site. If you are on WebMatrix and Razor band wagon. Give it a try.

Till next time, Happy Coding and Code with Passion

Technorati Tags:
  
del.icio.us Tags:
Filed under: ,

Comments

# Twitter Trackbacks for WEbmatrix???helpers???Bing - kashyapa's .NET Rumbles [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 WEbmatrix???helpers???Bing - kashyapa's .NET Rumbles         [asp.net]        on Topsy.com

# re: WEbmatrix–helpers–Bing

Friday, October 08, 2010 3:30 AM by hajan

Nice example. The WebMatrix Helpers are very handy tool that help you add great features with practically only one line of code.

# re: WEbmatrix–helpers–Bing

Friday, October 08, 2010 4:47 AM by Lohith

@hajan

Thanks for the comments. Appreciate this.

regards

Lohith

# re: WEbmatrix–helpers–Bing

Thursday, November 11, 2010 9:55 AM by PaoloTCS

Thanks!  How could one search using passed parameters (using SQL Server, e.g.)

for example:

ColName            ColumnEntry

DateOfBirth:      dd MM YYYY

DateOfDeath:    dd MM YYYY

Artists:               (NULL)

FamousDates:  

Have Bing search "Artists" living between DateOfBirth and DateOfDeath and insert info into SQL Server ...

or  Search "FamousDates" , or whatever, and insert them or display them onto MVC or aspx page?

Thanks again,

Paolo

# re: WEbmatrix–helpers–Bing

Wednesday, August 17, 2011 12:04 AM by cluster

realmente extraГ±amente  

http://eru1.myftp.biz/  

kole

# re: WEbmatrix–helpers–Bing

Friday, August 26, 2011 7:36 AM by shampaign

Que palabras adecuadas... La frase fenomenal, excelente  

http://rsfiles.servehttp.com/  

sonny

# re: WEbmatrix–helpers–Bing

Wednesday, November 14, 2012 9:13 AM by north face jackets sale

Hi would you mind stating which blog platform you're working with? I'm going to start my own blog soon but I'm having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I'm looking for something completely unique.                  P.S My apologies for being off-topic but I had to ask!

# re: WEbmatrix–helpers–Bing

Tuesday, January 22, 2013 12:56 AM by maillot de foot pas cher 2013

mais toute léquipe et nous avons pu aller de lavant que toute une équipe , et Eddie Johnson dirigé une au début de la 64e, mais à la fin tout ce qui compte cest le résultat , e ont une journée loin dêtre de ladministration . Nous sommes maintenant stable financièrement, mais parce quil ya tellement de choses qui peuvent mal se passer dans un jeu unique, lorsque Zach Scott a marqué lors de la victoire 1-0 sur Colorado ?

maillot de foot pas cher 2013 www.maillotdefootpascher1314.com

# re: WEbmatrix–helpers–Bing

Friday, February 15, 2013 4:00 PM by Boyd

My programmer is trying to persuade me to move to .

net from PHP. I have always disliked the idea because of the expenses.

But he's tryiong none the less. I've been using WordPress on a

variety of websites for about a year and am concerned about switching to

another platform. I have heard very good things about blogengine.

net. Is there a way I can transfer all my wordpress posts into it?

Any help would be greatly appreciated!

# re: WEbmatrix–helpers–Bing

Sunday, February 17, 2013 8:13 PM by Martino

I don't even know how I ended up here, but I thought this post was great. I do not know who you are but definitely you're going to a famous blogger

if you are not already ;) Cheers!

# re: WEbmatrix–helpers–Bing

Tuesday, February 19, 2013 5:05 PM by Holiday

Hello, i think that i saw you visited my website thus i came to “return the favor”.

I am attempting to find things to enhance my site!

I suppose its ok to use a few of your ideas!!

# re: WEbmatrix–helpers–Bing

Tuesday, February 19, 2013 8:56 PM by Ochs

Very good article. I will be going through many of these issues as well.

.

# re: WEbmatrix–helpers–Bing

Tuesday, February 26, 2013 8:25 AM by survivalgear

Hillary camping gear most don't know why but for a survival kit".  <a href="http://survival-gear.info" title="survival gear">survival gear</a> This morning featured an extended story in the sides and back reflectivity improves low light.

# re: WEbmatrix–helpers–Bing

Monday, March 04, 2013 5:17 AM by Moreland

Fine way of explaining, and nice piece of writing to obtain facts regarding my presentation subject

matter, which i am going to convey in institution of higher education.

# re: WEbmatrix–helpers–Bing

Wednesday, March 06, 2013 2:42 AM by njcbfzesqwa@gmail.com

les enfants crient ? Bonbons sil-vous-pla?t ! Le train NDS offre une grande variété de services lorsque les utilisateurs achètent la carte, 6????? Attendez jusqu’à la mise à jour est finie avec succès. industrie des cartes flash et fabrique des produits de grandes que l&rsquo .

# re: WEbmatrix–helpers–Bing

Wednesday, March 06, 2013 10:15 PM by akrrvei@gmail.com

vous devez mettre à jour votre carte r4i sdhc dual core avec un DS Lite, Carte r4i-SDHC 3DS Ladapteur r4i pour?Nintendo DSi / DSi est la dernière technique de flash mémoire pour Nintendo DSi ! Une puce 6 fois plus puissante que le Tegra actuel selon le constructeur! comme vous pouvez le voir sur les premiers visuels . ainsi que sa date de sortie pour l&rsquo. dans un immense hall où règne le crépuscule .

# re: WEbmatrix–helpers–Bing

Friday, March 08, 2013 9:57 AM by xqezuelnubk@gmail.com

importe quelle vitesse de carte MicroSD sans retard dans le jeu Prise en charge Clean ROM . Un jeu par exemple est diabolique calculs, exécuter des applications et lire les médias directement depuis le périphérique , Notes  Supercard DSONEi caractéristiques mini est l&rsquo, Une machine tournant sous Android et basée sur son nouveau processeur graphique pour mobile Tegra 4, Opération apparemment menée sans latence ni la moindre saccade. Nintendo précise néanmoins que la presse pourra en savoir davantage au cours de lE3.

# re: WEbmatrix–helpers–Bing

Friday, March 08, 2013 9:38 PM by lauzjeynq@gmail.com

car il prend facilement en charge nimporte quel type et le type de carte Micro SD, il indique que le nom de fichier est trop long . 32G Périphérique de stockage de deuxième génération aucun outil de démarrage requis Rincer la fente de montage 1 carte Utilisez la carte MicroSD! enrter autolatiquement dans le mode optimisé Double UI éran avec des ic?nes . Plusieurs jeux sont les suivants  Detective Saburo Shrine Temple  Revenge of the ronde – ¥ 4200 version cassette – ¥ 5040 Nintendogs + Cats 3 quantités  – chaque ¥ 4800 Carte Summoner – ¥ 4800 Super Pokemon Luanzhan – ¥ 4800 Fire Emblem Awakening – ¥ 4800 Football Happy – ¥ 4800 La date de téléchargement de ??Detective Jingu Temple Saburo  Revenge of the ronde?? est de 31 Janvier, dessinée à la main décor et les objets où les joueurs peuvent aider le héros du jeu.

# re: WEbmatrix–helpers–Bing

Monday, March 11, 2013 1:48 AM by dzzfsyy@gmail.com

* Prend en charge le jeu de téléchargement, il appara?t est un projet collaboratif de les cerveaux de Namco Bandai, Le jeu lui-même a été développé par Monolith Soft et Banpresto ! Je sais que je vais être pré-commander mon exemplaire dès qu&rsquo , 32G Périphérique de stockage de deuxième génération aucun outil de démarrage requis Rincer la fente de montage 1 carte Utilisez la carte MicroSD.

# re: WEbmatrix–helpers–Bing

Sunday, March 17, 2013 5:06 AM by Wise

Highly descriptive post, I liked that bit. Will there be a

part 2?

# re: WEbmatrix–helpers–Bing

Sunday, March 17, 2013 9:29 AM by Oswald

Fantastic goods from you, man. I've understand your stuff previous to and you're just extremely wonderful.

I actually like what you've acquired here, certainly like what you're stating and the way in which

you say it. You make it enjoyable and you still care for to keep it smart.

I can't wait to read far more from you. This is actually a wonderful website.

# re: WEbmatrix–helpers–Bing

Thursday, March 28, 2013 7:09 AM by fersterku@hotmail.com

I similar to the significant details you provide inside of your article content.I’ll bookmark your blog site and check again here repeatedly.I’m quite sure I will gain knowledge of quite a bit of latest stuff best suited listed here! High-quality luck for that upcoming!

# re: WEbmatrix–helpers–Bing

Sunday, March 31, 2013 1:54 PM by Bayne

Link exchange is nothing else but it is only placing the

other person's website link on your page at appropriate place and other person will also do same in favor of you.

# re: WEbmatrix–helpers–Bing

Thursday, April 04, 2013 11:40 AM by Kuntz

Whats up are using Wordpress for your site platform? I'm new to the blog world but I'm trying to get started and set

up my own. Do you need any html coding expertise to make your own

blog? Any help would be greatly appreciated!

# re: WEbmatrix–helpers–Bing

Saturday, April 06, 2013 4:40 AM by ljbwnbk@gmail.com

I like this post, enjoyed this one appreciate it for putting up.

# re: WEbmatrix–helpers–Bing

Tuesday, April 16, 2013 2:17 AM by Campbell

I am curious to find out what blog system you

happen to be utilizing? I'm having some small security issues with my latest blog and I would like to find something more safeguarded. Do you have any solutions?

# re: WEbmatrix–helpers–Bing

Thursday, May 09, 2013 9:30 PM by bokal1@outlook.com

这种眼镜品牌博士伦成立于1937年,他们推出了第一双防强光眼镜世界的飞行员。提供技术先进的镜片,以保护眼睛不受阳光,Ray-Ban的安全与风格相结合,在其范围开拓创新的眼镜。他们的小型收集灵感从成人的线,在其使用大胆的色彩和经典的设计。

# re: WEbmatrix–helpers–Bing

Thursday, May 16, 2013 6:27 AM by qrbgvbqwcq@gmail.com

this is great blog, I will certainly be back.

Leave a Comment

(required) 
(required) 
(optional)
(required)