|
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 ?
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 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!
|
|
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.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 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!
|
|
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.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 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!
|
|
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 ?
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Absolutely, just remember its a 30 day key. -your feedback is helpful to other users, thank you!
|
|