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).

2
  • 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 :) Commented Sep 10, 2013 at 14:56
  • Thank you it was what I needed. you can write it as answer then I mark it. Commented Sep 11, 2013 at 7:26

1 Answer 1

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 :)

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.