Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

get SearchResult's ResultItemTemplate value progr. - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
prashant
#1 Posted : Thursday, February 12, 2015 2:33:07 AM
Rank: Member

Groups: Registered

Joined: 2/3/2015
Posts: 12
Hello,

example :

.aspx page
<searchengine:SearchResult ID="SearchResult1" .......

<ResultItemTemplate>
<asp:label ID="lblTitle" runat="server" Text = "<%# Container.Title %>">
</asp:label>
</ResultItemTemplate>
</searchengine:SearchResult>

in code behind, using searchresult event i want to access lblTitle Text which is place inside ResultItemTemplate and pass that value as parameter in my own written method.

is their any event for SearchResult control, like Gridview's OnRowDataBound Event from where i can read any value of cell for that row ?
Jim
#2 Posted : Thursday, February 12, 2015 12:37:28 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Hi, yes just use the ItemCreated event in SearchResult along with FindControl. There's an example here

http://keyoti.com/produc...ith%20Custom%20Data.htm

Code:

protected void Sr1_ItemCreated(object sender, Keyoti.SearchEngine.Web.SearchResultItemEventArgs e)

{

    if (e.Item is Keyoti.SearchEngine.Web.ResultItem){

        Label dateLabel = e.Item.FindControl("dateLabel") as Label;

        if (dateLabel != null){

            try {

                DateTime docDate = DateTime.Parse((e.Data as Keyoti.SearchEngine.Search.ResultItem).DocumentRecord.CustomData);

                dateLabel.Text = docDate.ToLongDateString();

            }

            catch (FormatException){

                //wasn't a date

            }

        }

    }

}


Best
Jim


-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


prashant
#3 Posted : Thursday, February 12, 2015 2:03:58 PM
Rank: Member

Groups: Registered

Joined: 2/3/2015
Posts: 12
Hi,

example that i had mention, in that i assigned <%# Container.Title %> value to label "lblTitle". but when access value from code behind in Sr1_ItemCreated Event of searchResult control, by finding control using findControl it didn't return that value.

i want to use that <%# Container.Title %> value as a procedure parameter , to find other details from database and add that result into resulttemplate of searchResult control.
Jim
#4 Posted : Thursday, February 12, 2015 2:34:34 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
I see, I'm not certain but it might not be working because the DataBind happens after ItemCreated - anyway there's a simpler way to do it

Code:

protected void Sr1_ItemCreated(object sender, Keyoti.SearchEngine.Web.SearchResultItemEventArgs e)

{

    if (e.Item is Keyoti.SearchEngine.Web.ResultItem){

        string title = (e.Data as Keyoti.SearchEngine.Search.ResultItem).DocumentRecord.Title;

       

    }

}


there's a lot of information available using (e.Data as Keyoti.SearchEngine.Search.ResultItem).



-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


prashant
#5 Posted : Friday, February 13, 2015 6:53:46 AM
Rank: Member

Groups: Registered

Joined: 2/3/2015
Posts: 12
thanks..!.
above snippet of code fullfill a requirements.
can you please provide Lite & pro trial version license's key.
Jim
#6 Posted : Friday, February 13, 2015 2:12:12 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Sure;

Pro: 5A556A61675D69626B5C6D6C644854263D4143463B40453E45404645474C454C5052404

Lite: 5752675E645A665F68596A69615A66383F3A3A41383D423B423D43424449424E4949509

Jim

-your feedback is helpful to other users, thank you!

-your feedback is helpful to other users, thank you!


prashant
#7 Posted : Tuesday, February 17, 2015 3:02:21 PM
Rank: Member

Groups: Registered

Joined: 2/3/2015
Posts: 12
Hi,

can i use above trial license key on UAT server to test the functionality ?
Jim
#8 Posted : Tuesday, February 17, 2015 3:43:05 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,667
Location: Canada
Absolutely, just remember its a 30 day key.
-your feedback is helpful to other users, thank you!


Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.