Håber det kan hjælpe,- :-(
Min Menu.ascx fil:
------------------------------------------------------------------------
<%@ Control Language="vb" AutoEventWireup="false" Src="Menu.ascx.vb" Inherits="Menu" TargetSchema="
http://schemas.microsoft.com/intellisense/ie5" %>
<table style="width:200px;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="qSearch">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td width="8" rowspan="4"><img src="../Image/1x1.gif" /></td>
</tr>
<tr>
<td><font color="White">Søg:</font></td>
</tr>
<tr>
<td valign="top">
<asp:TextBox
ID="txtSearch"
style="WIDTH: 140px; HEIGHT: 19px"
CssClass="TextBox" Runat="Server"
/>
<asp:Button
ID="btnSearch"
OnCLick="SubmitSearch"
Text="Go"
Runat="Server"
/>
</td>
</tr>
<tr>
<td><a class="white" href="
https://www.e coders.com/autohuset/Secure/aSearch.aspx"">Avancerede søgning</a></td>
</tr>
</table>
</td>
</tr>
</table>
Min Menu.ascx.vb fil:
---------------------------------------------------------------------
Option Explicit On
Option Strict On
Imports System
Imports System.Web.UI
Imports System.Web.UI.UserControl
Imports System.Configuration
Imports System.Configuration.ConfigurationSettings
Imports System.Data
Imports System.Data.SqlClient
Public MustInherit Class Menu : Inherits System.Web.UI.UserControl
Public txtSearch As System.Web.UI.WebControls.TextBox
Sub SubmitSearch(ByVal Source As System.Object, ByVal e As System.EventArgs)
Response.Redirect("qSearch.aspx?keyword=" & txtSearch.Text & "")
End Sub
End Class
Min qSearch.aspx fil:
-----------------------------------------------------------------------------
<%@ Page Language="vb" AutoEventWireup="False" Debug="True" Src="qSearch.aspx.vb" Inherits="qSearch"%>
<%@ Register TagPrefix="UC" TagName="Header" Src="Controls/Header.ascx" %>
<%@ Register TagPrefix="UC" TagName="SubHeader" Src="Controls/SubHeader.ascx" %>
<%@ Register TagPrefix="UC" TagName="Footer" Src="Controls/Footer.ascx" %>
<%@ Register TagPrefix="UC" TagName="Menu" Src="Controls/Menu.ascx" %>
<html>
<head>
<title>Autohuset - Søg</title>
<link href="Style/iestyle.css" type="text/css" rel="stylesheet" />
</head>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" Runat="Server">
<table style="width:100%; height:100%;" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" valign="top">
<UC:Header ID="Header" Runat="Server" Message="Velkommen til Autohuset" />
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<UC:SubHeader ID="SubHeader" Runat="Server" />
</td>
</tr>
<tr>
<td class="Menu" valign="top">
<UC:Menu ID="Menu" Runat="Server" />
</td>
<td style="height:100%;" valign="top">
<table style="width:560px;" cellpadding="5" cellspacing="5" border="0">
<tr>
<td>Søg:</td>
</tr>
<tr>
<td align="center">
<asp:DataGrid
ID="dgSearch"
Runat="Server"
ShowHeader="True"
ShowFooter="False"
CellPadding="5"
CellSpacing="0"
BorderStyle="Solid"
BorderWidth="1"
BorderColor="#cccccc"
Font-Name="tahoma"
Font-Size="8pt"
BackColor="#f0f1f6"
/>
<asp:Label ID="lblNoResult" Runat="server" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="height:100%;"><img src="Image/1x1.gif" /></td>
</tr>
<tr>
<td colspan="2" valign="bottom"><UC:Footer ID="ucFooter" Runat="Server" /></td>
</tr>
</table>
</form>
</body>
</html>
Min qSearch.aspx.vb fil:
-----------------------------------------------------------------------------
Option Explicit On
Option Strict On
Imports System
Imports System.Web.UI
Imports System.Web.UI.UserControl
Imports System.Configuration
Imports System.Configuration.ConfigurationSettings
Imports System.Data
Imports System.Data.SqlClient
Public Class qSearch : Inherits System.Web.UI.Page
Public dgSearch As System.Web.UI.WebControls.DataGrid
Public lblNoResult As System.Web.UI.WebControls.Label
Sub Page_Load(ByVal Source As System.Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack Then
DataFiller()
End If
End Sub
Sub DataFiller()
Dim strConnection As String = Configuration.ConfigurationSettings.AppSettings("Autohuset")
Dim objConnection As New SqlConnection(strConnection)
objConnection.Open()
Dim strSQL As String = "SELECT * FROM Brugere "
strSQL += "WHERE Varenr LIKE = '%" & Request.QueryString("keyword") & "%'"
strSQL += " OR Varenavn LIKE = '%" & Request.QueryString("keyword") & "%'"
strSQL += " OR Pris LIKE = '%" & Request.QueryString("keyword") & "%'"
strSQL += " OR Leverandør LIKE = '%" & Request.QueryString("keyword") & "%'"
Dim objAdapter As New SqlDataAdapter(strSQL, objConnection)
Dim objDataSet As New DataSet()
objAdapter.Fill(objDataSet, "dtVare")
dgSearch.DataSource = objDataSet.Tables.Item("dtVare")
dgSearch.DataBind()
objConnection.Close()
End Sub
End Class