I follow several samples and nothing seems wrong with my code, but I still receiving a NULL value error when I try to insert a value. The product_id parameter is not binded and pass onto the INSERT SQL statement. Here is my code
ASP.NET
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
DataSourceID
=
"SqlDataSource1"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
EnableLinqExpressions
=
"false"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"product_name"
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
telerik:RadAutoCompleteBox
ID
=
"radAutoCompleteBox1"
runat
=
"server"
DataSourceID
=
"SqlDataSource6"
DataTextField
=
"product_name"
DataValueField
=
"product_id"
InputType
=
"Text"
Delimiter
=
" "
SelectionMode
=
"Single"
Width
=
"300"
EmptyMessage
=
"Type product name..."
>
</
telerik:RadAutoCompleteBox
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
VB
Protected
Sub
RadGrid1_ItemDataBound(sender
As
Object
, e
As
GridItemEventArgs)
If
e.Item.IsInEditMode
Then
Dim
item
As
GridEditableItem =
DirectCast
(e.Item, GridEditableItem)
If
Not
(
TypeOf
e.Item
Is
IGridInsertItem)
Then
Dim
radAutoCompleteBox1
As
RadAutoCompleteBox =
DirectCast
(item.FindControl(
"radAutoCompleteBox1"
), RadAutoCompleteBox)
radAutoCompleteBox1.Entries.Add(
New
AutoCompleteBoxEntry(item(
"product_name"
).Text, item(
"product_name"
).Text))
End
If
End
If
End
Sub