Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • viral 48 posts 69 karma points
    Nov 28, 2010 @ 18:11
    viral
    0

    Search using XSLT

    Hi,

    I am using XSLT search and its working fine. But when i use my .net user control and put it on the page, xslt search doesn't work for my user control. It just search the contents which are on the page. So is there any limitation of XSLT search that it doesn't work for .net user control etc....? Any help will be highly appreciated.

     

     

    Thanks.

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 28, 2010 @ 22:11
    Aaron Powell
    0

    How are you trying to use it in a .NET control? XSLTSearch will work in a .NET control if you're running through an XSLT engine such as the Umbraco macro engine or you write your own.

    But XSLT search isn't really designed to be run from .NET, it's an XSLT component ;).

    Examine is a good alternative if you want to search in both .NET and XSLT, there's some videos to get you started with it on umbraco TV.

  • viral 48 posts 69 karma points
    Nov 28, 2010 @ 22:21
    viral
    0

    Thanks for your reply. I appreciated that.

    First of all i created macro that is the .net user control. And then i placed that macro into my page.  So how do i configure such a way that .net user control runs through XSLT engine? 

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 28, 2010 @ 23:03
    Aaron Powell
    0

    Either write your own XSLT engine or just put a <umbraco:Macro alias="XSLTSearch" runat="server" /> in your .NET macro.

  • viral 48 posts 69 karma points
    Nov 28, 2010 @ 23:19
    viral
    0

    well, my macro alias is "DisplayMessage", then how can i change to XSLTSearch.  Because two macro's alias should not be the same. And XSLTSearch macro is already exists.

    <umbraco:Macro Alias="DisplayMessage" runat="server"></umbraco:Macro>

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 28, 2010 @ 23:25
    Aaron Powell
    0

    <umbraco:Macro is an ASP.Net server control, so you can put it inside any other .NET server control.

    That's what you have to do, put your XSLTSearch macro inside the .NET one.

  • viral 48 posts 69 karma points
    Nov 28, 2010 @ 23:32
    viral
    0

    Hi,

    Here is my templete

    -------------------------------------------------------------------------------

    <%@ Master Language="C#" MasterPageFile="~/masterpages/RunwayMaster.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="RunwayMasterContentPlaceHolder" runat="server">

    <div id="content">

    <umbraco:Macro source="1051" searchFields="" previewFields="" searchBoxLocation="" previewType="" resultsPerPage="" previewChars="" showPageRange="0" showOrdinals="0" showScores="0" showStats="0" Alias="XSLTsearch" runat="server"></umbraco:Macro>

    <umbraco:Macro Alias="DisplayMessage" runat="server"></umbraco:Macro>

    <umbraco:Item field="pagename" runat="server"></umbraco:Item>

    <umbraco:Item runat="server" field="bodyText" />

    </div>

    <div id="subNavigation">

    </div>

    </asp:Content>

    -----------------------------------------------------------------------------------------

    DisplayMessage is my .net user control

    XSLTSearch is performing search.

    Now how can i placed Xsltsearch macro inside my .net control?

     

    Thanks.

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 28, 2010 @ 23:33
    Aaron Powell
    0

    Put this:

    <umbraco:Macro source="1051" searchFields="" previewFields="" searchBoxLocation="" previewType="" resultsPerPage="" previewChars="" showPageRange="0" showOrdinals="0" showScores="0" showStats="0" Alias="XSLTsearch" runat="server"></umbraco:Macro>

    In your ASCX file.

  • viral 48 posts 69 karma points
    Nov 28, 2010 @ 23:46
    viral
    0

    When i put in my .ascx file,

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DisplayMessage.ascx.cs" Inherits="WebApplication1.DisplayMessage" %>

    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

    Hi this is viral

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >

    <umbraco:Macro source="1051" searchFields="" previewFields="" searchBoxLocation="" previewType="" resultsPerPage="" previewChars="" showPageRange="0" showOrdinals="0" showScores="0" showStats="0" Alias="XSLTsearch" runat="server"></umbraco:Macro>I 

    I am getting following error.

     

     
    Error creating control (usercontrols/DisplayMessage.ascx).
    Maybe file doesn't exists or the usercontrol has a cache directive, which is not allowed! See the tracestack for more information!

     You've installed umbraco and a minimal Runway website. Edit the text on the homepage and create a site structure by adding new texpages to your site. This is all done in the Content section.If you find the editing options provided by Runway too limited for you needs, simply add more properties to the page by going to the Settings section, expanding the Document Types item and adding new properties on the Generic Properties tab. You can find more information about document types and properties at the umbraco website.

    ..................................

  • viral 48 posts 69 karma points
    Nov 28, 2010 @ 23:48
    viral
    0

    And i forgot to attach Stack Trace

    Here it is

     

    Error reading usercontrols/DisplayGrid.ascx

    The following list shows the Public Properties from the Control. By checking the Properties and click the "Save Properties" button at the bottom, umbraco will create the corresponding Macro Elements.

     

    System.Web.HttpParseException: Type 'System.Web.UI.WebControls.GridView' does not have a public property named 'Macro'. ---> System.Web.HttpParseException: Type 'System.Web.UI.WebControls.GridView' does not have a public property named 'Macro'. ---> System.Web.HttpException: Type 'System.Web.UI.WebControls.GridView' does not have a public property named 'Macro'. at System.Web.UI.ControlBuilder.GetChildPropertyBuilder(String tagName, IDictionary attribs, Type& childType, TemplateParser templateParser, Boolean defaultProperty) at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty) at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.Parse(ICollection referencedAssemblies, VirtualPath virtualPath) at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType() at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)

     

     

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 28, 2010 @ 23:52
    Aaron Powell
    0

    You put it inside an <asp:GridView element, you can't nest it inside a random .NET control

  • viral 48 posts 69 karma points
    Nov 29, 2010 @ 00:02
    viral
    0

    oh sorry...... i misplaced it.

     

    here it is : 

    .ascx

    -----------------------------

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DisplayMessage.ascx.cs" Inherits="WebApplication1.DisplayMessage" %>

    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

    Hi this is viral

    <umbraco:Macro source="" searchFields="" previewFields="" searchBoxLocation="" 

    previewType="" resultsPerPage="" previewChars="" showPageRange="0" showOrdinals="0" 

    showScores="0" showStats="0" Alias="XSLTsearch" runat="server"></umbraco:Macro>

    ----------------------------------

    templete :

    ------------------------------------

    <%@ Master Language="C#" MasterPageFile="~/masterpages/RunwayMaster.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="RunwayMasterContentPlaceHolder" runat="server">

    <div id="content">

    <umbraco:Macro Alias="DisplayMessage" runat="server"></umbraco:Macro>

    <umbraco:Item field="pagename" runat="server"></umbraco:Item>

    <umbraco:Item runat="server" field="bodyText" />

    </div>

    <div id="subNavigation">

    </div>

    </asp:Content>

    ----------------------------------------------

    Now, it shows on the page with xslt search. But the problem still remains same.  It doesn't search the content from user control.

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 29, 2010 @ 00:09
    Aaron Powell
    0

    Oh sorry, I miss-interpreted what you were trying to do (I thought you were trying to interact with XSLT Search from a .NET control).

    XSLTSearch doesn't search anything but the Umbraco XML cache, if you want to search something that's not from Umbraco you need to use Examine http://farmcode.org/post/2010/08/10/Using-Examine-to-index-search-with-ANY-data-source.aspx

  • viral 48 posts 69 karma points
    Nov 29, 2010 @ 00:12
    viral
    0

    No problem.... I really appreciated your help. Let me go through the link you have provided, hope it works for me nd if not then i will trouble you again.

    Thanks again.

  • viral 48 posts 69 karma points
    Nov 29, 2010 @ 00:23
    viral
    0

    Now, How do i use this Examine? Do i need to copy all .dll into bin/ folder thats it? i am not getting clear picture from the above link.

    Thanks.

  • Aaron Powell 1708 posts 3045 karma points c-trib
    Nov 29, 2010 @ 00:29
    Aaron Powell
    0

    There's videos on how to use Examine as part of an Umbraco.tv subscription: http://umbraco.tv/help-and-support/video-tutorials/developing-with-umbraco

    Creating your own indexer + search is not part of Umbraco though, those videos will get you underway with Examine and then you'll need to write some .NET (which is outlined in the above blog) to take the data from your external data source and put it into Examine for searching.

    There's no drag-and-drop solution for indexing external data sources. 

  • viral 48 posts 69 karma points
    Nov 29, 2010 @ 00:31
    viral
    0

    Understood. Thanks again for all your help.

Please Sign in or register to post replies

Write your reply to:

Draft