or
private void radScheduler1_DragDrop(object sender, DragEventArgs e) {DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject;Point point = this.radScheduler1.PointToClient(new Point(e.X, e.Y)); SchedulerDayViewGroupedByResourceElement groupedDayViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;SchedulerCellElement schedulerCell = SchedulerUIHelper.GetCellAtPoint(point, groupedDayViewElement.GetDayViewElements());SchedulerCellElement schedulerCell2 = SchedulerUIHelper.GetCells(this.radScheduler1).Where(x => x.Date >= schedulerCell.Date && x.Date <= SchedulerCell.Date.AddMinutes(((double)dragObject.Values[Enums.AppointmentFields.Duration])-1)&& x.Enabled == false).FirstOrDefault();
// Row struct in html view this.htmlView = new HtmlViewDefinition();this.htmlView.RowTemplate.Rows.Add(new RowDefinition());this.htmlView.RowTemplate.Rows.Add(new RowDefinition());this.htmlView.RowTemplate.Rows.Add(new RowDefinition());this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("IsLocked", 0, 1, 1));this.htmlView.RowTemplate.Rows[0].Cells.Add(new CellDefinition("name", 0, 3, 1));this.htmlView.RowTemplate.Rows[1].Cells.Add(new CellDefinition("details", 0, 4, 1));this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("preview", 0, 1, 1));this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("insert", 0, 1, 1));this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("remove", 0, 1, 1));this.htmlView.RowTemplate.Rows[2].Cells.Add(new CellDefinition("link", 0, 1, 1));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 FunctiongvSpecialInst.AutoScroll = True
gvSpecialInst.Rows(5).IsSelected = TruegvSpecialInst.Rows(5).IsCurrent = TruegvSpecialInst.TableElement.ScrollToRow(gvSpecialInst.Rows(5))bindingSource.DataSource = tmrC.ViewableData;