Google Answers Logo
View Question
 
Q: Highlight Search Phrase using Dreamwaever MX ( No Answer,   0 Comments )
Question  
Subject: Highlight Search Phrase using Dreamwaever MX
Category: Computers > Programming
Asked by: gwphillipson-ga
List Price: $50.00
Posted: 29 Oct 2004 06:29 PDT
Expires: 29 Oct 2004 12:14 PDT
Question ID: 421632
highlight search phrase in dreamwaever mx 2004

Code
Hi 
Can anyone help solve this problem, 
When I enter the variable into the datagrid, 
all the <%=HighlightWord%> are the same even through the rest of the 
results change correctly. i.e title and pageurl change for each record,
but the "><%=HighlightWord%> is the same for each. 
Can anyone help solve this problem. 
Below is the code: 

********* dataset Code****************
<MM:DataSet
runat="Server"
id="spQueryResults"
IsStoredProcedure="true"
CreateDataSet="true"
ConnectionString='<%#
System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_*********"]
%>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_*********"]
%>'
CommandText="dbo.sp_TDQueryResults"
FailureURL='<%# "../error.htm" %>' PageSize="10"
>
  <Parameters>
    <Parameter  Name="@RETURN_VALUE"   Type="Int"   Direction="ReturnValue" />
    <Parameter  Name="@SearchPhrase"  Value='<%#
((Request.QueryString["TxtQuery"] != null) &&
(Request.QueryString["TxtQuery"].Length > 0)) ?
Request.QueryString["TxtQuery"] : "" %>'  Type="VarChar"  Size="100" 
Direction="Input" />
  </Parameters>
</MM:DataSet>

*****************Body Code*****************

void Page_Load(Object Src, EventArgs E) 
{ inputString = Request.QueryString["TxtQuery"]; 
string[] words = GetQueryStringToArray(Request.QueryString["TxtQuery"].ToString())
;
Word1 = words[0]; 
Word2 = words[1]; 
Word3 = words[2]; 
Word4 = words[3]; 
Word5 = words[4]; 
Word6 = words[5]; 
HighlightWord = spQueryResults.FieldValue("PageDescription", null); 
HighlightWord = Regex.Replace(HighlightWord, Word1, ""+Word1+"",
RegexOptions.IgnoreCase);
HighlightWord = Regex.Replace(HighlightWord, Word2, ""+Word2+"",
RegexOptions.IgnoreCase);
} public string[] GetQueryStringToArray(string inputString) 
{ 
string[] finalSetOfWords = new string[6]; char[] separators = {' '};
string[] words = inputString.Split(separators);
for ( int i=0; i < 6; i++) { if(words.Length > i && inputString.Trim().Length > 0) 
{
finalSetOfWords = words; 
} 
else 
{ finalSetOfWords = "NNN"; 
}
} return finalSetOfWords; } 

Datadrid details 

<Columns> <asp:TemplateColumn runat="server"> 
<itemtemplate> 
<span class="QuCssResultsTitle"><%#
spQueryResults.FieldValue("PageTitle", Container) %></span>
<span class="QuCssResultsBody"><%=HighlightWord%></span>
<span class="QuCssResultsURL"><%# spQueryResults.FieldValue("PageURL",
Container) %></span>
</itemtemplate></asp:TemplateColumn> </columns> 


George
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy