If you attempt to use the controls in a partial trust environment you may be presented with a SecurityException when using the FeaturedResults control.
This is because the FeaturedResults control uses a standard TypeConverter pattern to convert from design-time values to run-time values, and TypeConverters require Full trust (since they create instances of objects).
To work-around this, please do the following:
1. Ensure that you DO NOT set the FeaturedDocuments property in the FeaturedResults designer. Change view to Source/HTML to check that this is not set to anything (including empty string). If you have already set the FeaturedDocuments property, place a copy of the string set in the HTML view on the clipboard as this will be useful in step 2. Eg. copy FeaturedDocuments="...all this..."
2. You will need to set the FeaturedDocuments property in code-behind (to avoid the TypeConverter).
a) If you have placed the FeaturedResults control DIRECTLY on the form, then you can easily call
FeaturedResults1.FeaturedDocuments = new Keyoti.SearchEngine.Web.FeaturedDocuments(".....");
b) If you have placed the FeaturedResults control INSIDE THE HEADER of the SearchResult control, then you will need to hook into the ItemCreated event to access the FeaturedResults control when it is created. Do this by attaching a handler to the ItemCreated event
this.SearchResult1.ItemCreated += new Keyoti.SearchEngine.Web.SearchResult.SearchResultItemEventHandler(SearchResult1_ItemCreated);
and in the event handler, access the FeaturedResults control and set it's property
void SearchResult1_ItemCreated(object sender, Keyoti.SearchEngine.Web.SearchResultItemEventArgs e) { if (e.Item is Keyoti.SearchEngine.Web.Header) { Keyoti.SearchEngine.Web.FeaturedResults fr = (Keyoti.SearchEngine.Web.FeaturedResults)e.Item.FindControl("FeaturedResults1"); fr.FeaturedDocuments = new Keyoti.SearchEngine.Web.FeaturedDocuments("...."); }
}
Here's a complete example, using the FeaturedDocuments property from our examples
public void Page_Load(object sender, EventArgs e){
this.SearchResult1.ItemCreated += new Keyoti.SearchEngine.Web.SearchResult.SearchResultItemEventHandler(SearchResult1_ItemCreated); }
void SearchResult1_ItemCreated(object sender, Keyoti.SearchEngine.Web.SearchResultItemEventArgs e) { if (e.Item is Keyoti.SearchEngine.Web.Header) { Keyoti.SearchEngine.Web.FeaturedResults fr = (Keyoti.SearchEngine.Web.FeaturedResults)e.Item.FindControl("FeaturedResults1"); fr.FeaturedDocuments = new Keyoti.SearchEngine.Web.FeaturedDocuments("http://www.amazon.com/gp/product/0451527747|Buy Alice's Adventures In Wonderland|Get this classic book now from Amazon|alice, adventure, wonderland||http://www.amazon.com/gp/product/0141439491|Buy Gulliver's Travels|The classic, Gulliver's Travels|gulliver, travels, adventure||http://www.keyoti.com/support|Support Forum|Visit the Keyoti support forum|support, help, question"); }
}
If you have trouble please email support@keyoti.com
|