Private
Sub
fetchAutoBoxItems(
ByVal
sender
As
Object
,
ByVal
e
As
AutoCompleteBoxDataSourceSelectEventArgs)
' Dim source As SqlDataSource = DirectCast(e.DataSource, SqlDataSource)
'Dim autoCompleteBox As RadAutoCompleteBox = DirectCast(sender, RadAutoCompleteBox)
Dim
filterstring
As
String
= e.FilterString
sqlDS.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
sqlDS.SelectCommand =
"my_db.dbo.my_SP"
sqlDS.SelectParameters(
"SearchTerm"
).DefaultValue = filterstring
End
Sub
Private
Sub
BuildMenuBar()
Dim
radAutoBox =
New
RadAutoCompleteBox
radAutoBox.InputType = RadAutoCompleteInputType.Text
radAutoBox.TextSettings.SelectionMode = RadAutoCompleteSelectionMode.
Single
radAutoBox.ID =
"radAutoBox"
AddHandler
radAutoBox.DataSourceSelect,
AddressOf
fetchAutoBoxItems
radAutoBox.Filter = RadAutoCompleteFilter.StartsWith
radAutoBox.DataSource = sqlDS
sqlDS.SelectParameters(
"userid"
).DefaultValue =
CStr
(_securityContext.UserID)
sqlDS.SelectParameters(
"divisionid"
).DefaultValue =
CStr
(_securityContext.DivisionId)
radAutoBox.DataTextField =
"StockSizeGroupName"
radAutoBox.DataValueField =
"StockSizeGroupID"
Master.Menubar.Add(radAutoBox)
<
asp:SqlDataSource
runat
=
"server"
ID
=
"sqlDS"
ConnectionString="<%$ ConnectionStrings:DefaultSqlConnection%>" >
<
SelectParameters
>
<
asp:Parameter
DbType
=
"Int32"
Name
=
"userid"
/>
<
asp:Parameter
DbType
=
"Int32"
Name
=
"divisionid"
/>
<
asp:Parameter
DbType
=
"String"
Name
=
"SearchTerm"
/>
</
SelectParameters
>
</
asp:SqlDataSource
>
I am able to get the AutoCompleteBox to work nicely with the above code, but what i wish to do, though, is have the AutoComplete List appear in a GridView/DataGrid instead of the dropdownlist of the AutoCompleteBox.
Is this possible? I am unable to get my GridView to share the same SqlDataSource Control due to the GridView never showing so i'm sure its not binding properly.
<
asp:GridView
ID
=
"gvAutoBox"
runat
=
"server"
>
<
Columns
>
<
asp:BoundField
DataField
=
"StockSizeGroupName"
/>
<
asp:BoundField
DataField
=
"StockSizeGroupID"
/>
<
asp:BoundField
DataField
=
"StockSizeName"
/>
</
Columns
>
</
asp:GridView
>
'add the following two lines below the ' Master.Menubar.Add(radAutoBox)' line in the 'BuildMenuBar' method
gvAutoBox.DataSource = sqlDS
gvAutoBox.DataBind()
the BuildMenuBar Method is being called from the Page_Load Event