0

I have created a Term Set (Channels) which is marked as "Available for Tagging" and "use this term set for Site Navigation" and for its "Target Page Settings" I chose Topics.aspx in pages list. This Term Set contains some terms. I have configured the vertical navigation to use this Term Set. I have created a MyImages list which contains a Managed Metadata column that points to Channels Term set. All images within this MyImage list have been tagged by a term in Channels term set.

Now when you click an item in Vertical Navigation, I want to show only those images that have been tagged by same term as Navigation Item. When I have "Content Search Web Part" in Topics.aspx and its Query has been configured to use owstaxIdMetadataAllTagsInfo:{Term}, it works perfectly. but I want to use Keyword Query Language in my own web part. My problem is how can I get the name of the term when you click the navigation Item? (to use it in my KQL).

  • You can find the term in the query string! It's stored at the key TermId. Invisible from the user, but check in the HttpContext in the code behind and there it is :) – Robert Lindgren Sep 10 '13 at 14:56
  • Thank you it was what I needed. you can write it as answer then I mark it. – Medes Sep 11 '13 at 7:26
1

You can find the term in the query string!

It's stored at the key TermId. Invisible from the user, but check in the HttpContext in the code behind and there it is :)

Like:

string termId = HttpContext.Current.Request.QueryString["TermId"]

and a little tip for working with the term id in the KQL

use the following syntax for filtering on the term id:

var query = string.Format("YOUR_MANAGEPROPERTY:\"GP0|#{0}\"", termId)

this will make sure you only get direct hits :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.