or
bool
isItemVisible(MyBusinessLogicClass c)
{
for
(
int
y = listView.Height; y > 10; y -= 10)
{
var result = listView.ElementTree.GetElementAtPoint(
new
Point(5, y),
x => (x
is
SimpleListViewVisualItem) && ((SimpleListViewVisualItem)x).Data.DataBoundItem == c);
if
(result !=
null
)
return
true
;
}
return
false
;
}
Private Sub rgvProducts_CellValidating(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CellValidatingEventArgs) Handles rgvProducts.CellValidating
Dim col As GridViewDataColumn = e.Column
Dim validateMessage As String = ""
lblMsg.Text = ""
If quitValidating Then
Return
End If
If e.Row IsNot Nothing Then
'if new row and field entered is "ProductCode"
If e.Row.GetType Is GetType(GridViewNewRowInfo) AndAlso col.FieldName = "ProductCode" Then
If String.IsNullOrWhiteSpace(e.Value) Then
'show validation message: cannot be blank
Return
End If
Dim coreProducts As DataTable
Dim lp As LabourProduct
Dim resultsMessage As String = ""
'Check if ProductCode value is valid against CoreProduct mapping
If ApplicationFunctions.fieldValidate("CoreProductCode", e.Value) Then
coreProducts = Labour.retrieveCoreProductRows("", e.Value, cl.Operation) 'retrieve set of CoreProduct rows filtered by Operation
If coreProducts.Rows.Count = 0 Then
'show validation message: No CoreProduct items found
Return
ElseIf coreProducts.Rows.Count = 1 Then 'if single row returned, allow editing in-line
rgvProducts.CurrentRow.Cells("ProductCode").Value = coreProducts.Rows(0)("CoreProductCode")
rgvProducts.CurrentRow.Cells("Operation").Value = coreProducts.Rows(0)("Operation")
rgvProducts.CurrentRow.Cells("ActualQuantity").Value = coreProducts.Rows(0)("StandardQuantity")
rgvProducts.CurrentRow.Cells("StandardQuantity").Value = coreProducts.Rows(0)("StandardQuantity")
rgvProducts.CurrentRow.Cells("StandardHours").Value = coreProducts.Rows(0)("StandardHours")
rgvProducts.CurrentRow.Cells("EarnedHours").Value = coreProducts.Rows(0)("StandardHours")
rgvProducts.CurrentRow.Cells("Description").Value = coreProducts.Rows(0)("ProductDescription")
Return
Else
resultsMessage = ProcessCoreProductDataTable(coreProducts) 'This adds multiple rows to grid and saves the objects
If Not resultsMessage = "Success" Then
'show validation message: Error saving
Return
Else 'Here trying to rebind the data source and cancel the edit
ApplicationFunctions.showMsg(lblMsg, resultsMessage, ApplicationFunctions.AlertModes.Positive)
rgvProducts.DataSource = ""
rgvProducts.DataSource = cl.LabourProductList
rgvProducts.CancelEdit()
End If
End If
Else 'if not matched against the CoreProduct, then trying to match against Product parent
coreProducts = Labour.retrieveCoreProductRows(e.Value, "", cl.Operation)
If coreProducts.Rows.Count > 0 Then 'if rows returned then add them
resultsMessage = ProcessCoreProductDataTable(coreProducts)
If Not resultsMessage = "Success" Then
ApplicationFunctions.showMsg(lblMsg, resultsMessage, ApplicationFunctions.AlertModes.Negative)
e.Row.ErrorText = resultsMessage
e.Cancel = True
Return
Else
ApplicationFunctions.showMsg(lblMsg, resultsMessage, ApplicationFunctions.AlertModes.Positive)
rgvProducts.DataSource = ""
rgvProducts.DataSource = cl.LabourProductList
rgvProducts.CancelEdit()
End If
'else show validation message: product code entered invalid
End If
End If
ElseIf (e.Row.GetType Is GetType(GridViewDataRowInfo) Or e.Row.GetType Is GetType(GridViewNewRowInfo)) And Not col Is Nothing Then 'only inline editing for any already entered rows
validateMessage = validate(col.FieldName, e.Value)
If validateMessage <> String.Empty Then ApplicationFunctions.showMsg(lblMsg, validateMessage, ApplicationFunctions.AlertModes.Negative)
End If
End If
End Sub
'add items in bulk and save
Private Function ProcessCoreProductDataTable(ByRef coreProducts As DataTable) As String
Dim saveMessage As String = ""
Dim lp As LabourProduct
For Each cp As DataRow In coreProducts.Rows
lp = New LabourProduct()
lp.LabourID = cl.LabourID
lp.ProductCode = cp("CoreProductCode")
lp.CoreBoxNumber = lp.ProductCode.Substring(lp.ProductCode.LastIndexOf("_C"))
lp.Operation = cp("Operation")
lp.ActualQuantity = cp("StandardQuantity")
lp.StandardQuantity = cp("StandardQuantity")
lp.StandardHours = cp("StandardHours")
lp.EarnedHours = cp("StandardHours")
lp.Description = cp("ProductDescription")
If Not lp.save(saveMessage) Then
Return saveMessage
Else
cl.LabourProductList.Add(lp)
End If
Next
Return saveMessage
End Function
gvSpecialInst.AutoScroll = True
gvSpecialInst.Rows(5).IsSelected =
True
gvSpecialInst.Rows(5).IsCurrent =
True
gvSpecialInst.TableElement.ScrollToRow(gvSpecialInst.Rows(5))
bindingSource.DataSource = tmrC.ViewableData;
Hi Team,
I want design the grid as per the attached screenshot. The infragistics grid have grid column show vertically. Please give any samples for this.
Thanks & Regards
Suresh
// Attaching the datasource
radGridView2.DataSource = _activeBatch.LigdagenKlinischGefactureerds.OrderBy(c => c.RowNumber);
// Expression column definition:
GridViewTextBoxColumn b =
new
GridViewTextBoxColumn(
"B"
)
{
HeaderText =
"B"
,
EnableExpressionEditor =
true
,
Expression = @
"IIF(ISNULL(PreviousNo,"
""
")<>No,"
"nieuw"
",null)"
};