asp.net - Can the results of my search be links to pages? -
I have a search engine on an ASP.net 4.0 VB site in which I have to link search results with my personal results Pages are required. I understand that this search can be done with a submit button after the text box but a submit button will not fit next to the search bar on my page, and it will not appear right.
The old way, the result is stored In the hidden lamps where they became the links of their pages. I was hoping that I can get the old search code included in the new search, but I do not know where it will be. The only way I can think of doing this is to give codes for some time in the webservice or for the loop. I can be away from the base here, but that's why I am asking what would be the best way to do this?
& lt; WebMethod () & gt; _ Public Function GetCompletionList (ByVal prefixText As String, ByVal count integer as) As String () Select product = "product as dim ProductSql string where ProductName like '" & amp; Prefix text & amp; SqlDataReader = myCommand.ExecuteReader () New DataTable myTable.TableName = "ProductSearch" myTable as new SqlCommand (ProductSql, sqlConn) Dim myReader as the new SqlConnection sqlConn.Open () MyCommand as "% '" dim sqlConn. Load as myReader) sqlConn.Close () string as dimmed items () = new string (myTable.Rows.Count - 1) {} I myTable.Rows in as dim int = 0 (each Dr. DataRow items Dr. ("for ProductName") as Dr.SetValue. Ostring (), i) i + = 1 next return item end function & amp; ASP: Script Manager id = "Script Manager1" runat = "server" & gt; & Lt; Services & gt; & Lt; Asp: ServiceReference path = "ProductSearch.asmx" /> & Lt; / Services & gt; & Lt; / ASP: ScriptManager & gt; & Lt; ASP: Text Box ID = "Search" Runat = "Server" Autocomplete = "Off" & gt; & Lt; / Asp: text box & gt; & Lt; ASP: AutoCompleteExtender id = "AutoCompleteExtender1" runat = "server" TargetControlID = "search" ServicePath = "~ / ProductSearch.asmx" ServiceMethod = "GetCompletionList" MinimumPrefixLength = "1" CompletionSetCount = "120" EnableCaching = "true" CompletionListCssClass = " Results "& gt; & Lt; / ASP: AutoCompleteExtender & gt; I used a little JavaScript, out of your search engine query results To create a link I have it now - though the web service does not work properly for each loop.
& lt; Asp: Content ID = "Content1" content placeholder id = "head" runat = "server" & gt; & Lt; Script type = "text / javascript" & gt; Function Autocamletclient mode (source, eventArg) {var value = eventArgs.get_value (); Window.location = ("/Product/Default.aspx?id=" + value)} & lt; / Script & gt; & Lt; / ASP: Content & gt; & Lt; Asp: Content ID = "Content2" content placeholder id = "body" runat = "server" & gt; & Lt; Asp: ScriptManager id = "ScriptManager1" runat = "server" & gt; & Lt; Services & gt; & Lt; Asp: ServiceReference path = "ProductSearch.asmx" /> & Lt; / Services & gt; & Lt; / ASP: ScriptManager & gt; & Lt; ASP: Text Box ID = "Search" Runat = "Server" Autocomplete = "Off" & gt; & Lt; / Asp: text box & gt; & Lt; ASP: AutoCompleteExtender ID = "AutoCompleteExtender1" runat = "Server" TargetControlID = "Search" ServicePath = "~ / ProductSearch.asmx" ServiceMethod = "GetProducts" MinimumPrefixLength = "1" CompletionSetCount = "120" EnableCaching = "true" OnClientItemSelected = " AutoCompleteClientMethod "& gt; & Lt; / ASP: AutoCompleteExtender & gt; & Lt; / ASP: Content & gt; & Lt; WebMethod () & gt; _ Public Function GetProducts (ByVal as the prefixText string, as in the form of ByVal counting integer) as the string () Dim ProductSql string = "ProductID, Product from product where product name like" & amp; In; Prefix text & amp; SqlDataReader = myCommand.ExecuteReader () New DataTable myTable.TableName = "ProductSearch" myTable as new SqlCommand (ProductSql, sqlConn) Dim myReader as the new SqlConnection sqlConn.Open () MyCommand as "% '" dim sqlConn. Load as myReader) sqlConn.Close () string as dimmed items () = new string (myTable.Rows.Count - 1) {} I myTable.Rows in as dim int = 0 (each Dr. DataRow items Dr. ("for ProductName") as SETValue. Ostring (), i) I + = 1 next return item end function end class
Comments
Post a Comment