Private Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles RadGrid1.ItemCommand
Dim strError As String = ""
Try
Select Case True
Case TypeOf e.Item Is GridEditFormItem
Select Case e.CommandName.ToUpper
Case "UPDATE"
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim strLocationCode As String
Dim bInactive As Boolean
Dim strID As String = RadGrid1.MasterTableView.DataKeyValues(e.Item.ItemIndex)("ID")
Try
'trap for invalid values
strLocationCode = ToString2(TryCast(editedItem("locncode").Controls(0), RadComboBox).SelectedValue)
bInactive = TryCast(editedItem("inactive").Controls(0), CheckBox).Checked
Catch ex As Exception
Me.lblError.Text = "Invalid values"
Exit Sub
End Try
Dim oFPForklift As New FPForklift(strID, App.ConnectionString)
oFPForklift.LOCNCODE = strLocationCode
oFPForklift.inactive = bInactive
oFPForklift.Save(App.ConnectionString)
RadGrid1.Rebind()
End Select
End Select
Catch ex As ThreadAbortException
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, strError, App.AppName, App.UserName, False)
Me.lblError.Text = ex.Message
End Try
End Sub
Private Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
Dim strError As String = ""
Try
If (TypeOf e.Item Is GridEditableItem AndAlso (e.Item.IsInEditMode)) Then
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim editMan As GridEditManager = editedItem.EditManager
'editor.DataSource = SPs.fp_IV40700_SEL_YardOperations(False, App.ConnectionString).getTable
'editor.DataBind()
'populate the location code ddl
Dim editor As GridDropDownListColumnEditor = CType(editMan.GetColumnEditor("locncode"), GridDropDownListColumnEditor)
Dim ddlLocncode As RadComboBox = editor.ComboBoxControl
Dim strLocationCode As String = ddlLocncode.SelectedValue
ddlLocncode.Items.Clear()
Dim oDT As New DataTable
oDT = SPs.fp_IV40700_SEL_YardOperations(False, App.ConnectionString).getTable
ddlLocncode.DataSource = oDT
ddlLocncode.DataValueField = "locncode"
ddlLocncode.DataTextField = "locncode"
ddlLocncode.DataBind()
ddlLocncode.SelectedValue = strLocationCode 'editor.SelectedText.Trim
'editor.DropDownListControl.SelectedValue = editor.SelectedText
End If
Catch ex As ThreadAbortException
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, strError, App.AppName, App.UserName, False)
Me.lblError.Text = ex.Message
End Try
End Sub