Hello! I had this in the javascript forum and VBScript, and was suggested to put it in this one.
This is my first try at this control,
I can type in the text box w/o any error, but don't see any suggestions
and there's a little blue box that appears under the box while I'm
typing. So, it looks like it's trying, but I've got something wrong.
The main page I'm trying to use is WebForm1:
<%@ Register TagPrefix="Custom" Namespace="ASB"
Assembly="AutoSuggestBox" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb"
Inherits="AutoCompleteTextBox1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content=" </HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<DIV style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px"
ms_positioning="text2D">
<Custom:AutoSuggestBox id="asbAuth" DataType="Authority"
runat="server"
CssClass="FormCtrlStyle" MaxLength="100" Columns="30"
ResourcesDir="/AutoCompleteTextBox1/asb_includes" />
</DIV>
</form>
</body>
</HTML>
The code behind is empty for this page, WebForm1.aspx.vb.
I did try to edit the GetAutoSuggestData.aspx.vb page such as to only
pull the "Authority" field from my table, Signature_Authority_Names.
This is a field which shows the last and first name of users.
Here's a simplified version of my code behind for GetAutoSuggestData.vb.aspx.
I can response.Write my SQL, and I know it's right
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Turn off cache
Response.Cache.SetCacheability(HttpCacheability.NoCache)
msTextBoxID = Request.QueryString("TextBoxID")
msMenuDivID = Request.QueryString("MenuDivID")
msDataType = Request.QueryString("DataType")
mnNumMenuItems =
Convert.ToInt32(Request.QueryString("NumMenuItems"))
mbIncludeMoreMenuItem =
Convert.ToBoolean(Request.QueryString("IncludeMoreMenuItem"))
msMoreMenuItemLabel = Request.QueryString("MoreMenuItemLabel")
msMenuItemCSSClass = Request.QueryString("MenuItemCSSClass")
msKeyword = Request.QueryString("Keyword")
'Get menu item labels and values
Dim aMenuItems As ArrayList = LoadMenuItems()
'Generate html and write it to the page
Dim sHtml As String
sHtml = AutoSuggestBox.GenMenuItemsHtml(aMenuItems, _
msTextBoxID, _
mnNumMenuItems, _
mbIncludeMoreMenuItem,
_
msMoreMenuItemLabel, _
msMenuItemCSSClass)
Response.Write(sHtml)
End Sub
Private Function LoadCities(ByVal sKeyword As String) As ArrayList
Dim aOut As ArrayList = New ArrayList
Dim sSql As String
Dim strKeyR As String = sKeyword.Replace("'", "''")
sSql = "Select Authority FROM Signature_Authority_Names WHERE
Authority Like '" & strKeyR & "%'"
Dim oCmd As SqlCommand = New SqlCommand(sSql, sCon1)
sCon1.Open()
Dim oReader As SqlDataReader = oCmd.ExecuteReader()
Dim sAuth As String
Dim sLabel As String
Dim oMenuItem As ASBMenuItem
While oReader.Read()
sLabel = sAuth
oMenuItem = New ASBMenuItem
oMenuItem.Label = sLabel
oMenuItem.Value = sAuth
aOut.Add(oMenuItem)
End While
oReader.Close()
sCon1.Close()
Return aOut
End Function
Function LoadMenuItems() As ArrayList
Dim aMenuItems As ArrayList
Select Case (msDataType)
Case "Authority"
aMenuItems = LoadCities(msKeyword)
Case Else
Throw New Exception("GetAutoSuggestData Type '" &
msDataType & "' is not supported.")
End Select
LoadMenuItems = aMenuItems
End Function
*********************************
*********************************
Thanks for any help or suggestions!
This is my first try at this control,
I can type in the text box w/o any error, but don't see any suggestions
and there's a little blue box that appears under the box while I'm
typing. So, it looks like it's trying, but I've got something wrong.
The main page I'm trying to use is WebForm1:
<%@ Register TagPrefix="Custom" Namespace="ASB"
Assembly="AutoSuggestBox" %>
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb"
Inherits="AutoCompleteTextBox1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content=" </HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<DIV style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px"
ms_positioning="text2D">
<Custom:AutoSuggestBox id="asbAuth" DataType="Authority"
runat="server"
CssClass="FormCtrlStyle" MaxLength="100" Columns="30"
ResourcesDir="/AutoCompleteTextBox1/asb_includes" />
</DIV>
</form>
</body>
</HTML>
The code behind is empty for this page, WebForm1.aspx.vb.
I did try to edit the GetAutoSuggestData.aspx.vb page such as to only
pull the "Authority" field from my table, Signature_Authority_Names.
This is a field which shows the last and first name of users.
Here's a simplified version of my code behind for GetAutoSuggestData.vb.aspx.
I can response.Write my SQL, and I know it's right
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Turn off cache
Response.Cache.SetCacheability(HttpCacheability.NoCache)
msTextBoxID = Request.QueryString("TextBoxID")
msMenuDivID = Request.QueryString("MenuDivID")
msDataType = Request.QueryString("DataType")
mnNumMenuItems =
Convert.ToInt32(Request.QueryString("NumMenuItems"))
mbIncludeMoreMenuItem =
Convert.ToBoolean(Request.QueryString("IncludeMoreMenuItem"))
msMoreMenuItemLabel = Request.QueryString("MoreMenuItemLabel")
msMenuItemCSSClass = Request.QueryString("MenuItemCSSClass")
msKeyword = Request.QueryString("Keyword")
'Get menu item labels and values
Dim aMenuItems As ArrayList = LoadMenuItems()
'Generate html and write it to the page
Dim sHtml As String
sHtml = AutoSuggestBox.GenMenuItemsHtml(aMenuItems, _
msTextBoxID, _
mnNumMenuItems, _
mbIncludeMoreMenuItem,
_
msMoreMenuItemLabel, _
msMenuItemCSSClass)
Response.Write(sHtml)
End Sub
Private Function LoadCities(ByVal sKeyword As String) As ArrayList
Dim aOut As ArrayList = New ArrayList
Dim sSql As String
Dim strKeyR As String = sKeyword.Replace("'", "''")
sSql = "Select Authority FROM Signature_Authority_Names WHERE
Authority Like '" & strKeyR & "%'"
Dim oCmd As SqlCommand = New SqlCommand(sSql, sCon1)
sCon1.Open()
Dim oReader As SqlDataReader = oCmd.ExecuteReader()
Dim sAuth As String
Dim sLabel As String
Dim oMenuItem As ASBMenuItem
While oReader.Read()
sLabel = sAuth
oMenuItem = New ASBMenuItem
oMenuItem.Label = sLabel
oMenuItem.Value = sAuth
aOut.Add(oMenuItem)
End While
oReader.Close()
sCon1.Close()
Return aOut
End Function
Function LoadMenuItems() As ArrayList
Dim aMenuItems As ArrayList
Select Case (msDataType)
Case "Authority"
aMenuItems = LoadCities(msKeyword)
Case Else
Throw New Exception("GetAutoSuggestData Type '" &
msDataType & "' is not supported.")
End Select
LoadMenuItems = aMenuItems
End Function
*********************************
*********************************
Thanks for any help or suggestions!