My grid view has 2 handlers, that should handle cell and row formatting.
grid.RowFormatting += gridViewRaces_RowFormatting;
grid.CellFormatting += gridViewRaces_CellFormatting;
And this is their code:
private void gridViewRaces_RowFormatting(object sender, RowFormattingEventArgs e)
{
e.RowElement.DrawFill = true;
e.RowElement.GradientStyle = GradientStyles.Solid;
e.RowElement.RowInfo.Cells[2].Style.BackColor = Color.Blue;
}
private void gridViewRaces_CellFormatting(object sender, CellFormattingEventArgs e) {
e.CellElement.DrawFill = true;
e.CellElement.GradientStyle = GradientStyles.Solid;
e.CellElement.BackColor = Color.Black;
}
}
But i've 2 problems:
1. Event CellFormatting doesn't fire on filling of Grid
2. RowFormatting is firing on filling of Grid, but color of cell doesn't change.
How to change cell color on GridView refresh/setting datasource?
I want to update grid row and show the selected value highlighted in GridViewComboBoxColumn so that i can change value from there.
Initially i try so many times but it will display only System.Data.DataRowView in GridViewComboBoxColumn.
Hi
I've got a radGridView like this below
Now I wanna drag a cell and it's value, like that is significanted by red line, and drop it into a vacant cell
would you please help me .. It's very essential and emergency
Hi,
How can i make application responsive UI ? with gridview i can make it with dock. But with textbox form data. Which approach for it ?
Thanks.
Hi ,
I am working with Treeview, i want to add columns behind the node to select. But i found out it does not support Treeview multi columns. and i found the solution RadGridView self-referencing. But my problem now is i want to have the behavior add children look like in Treeview. How can i do with RadGridView self-referencing ?
Thanks.
Hi,
I'm using ItemDrag event to drag&drop items from a RadTreeView to another control.
When a drag an item from the RadTreeView, the ItemDrag event is raised multiple times (While item moving) and the item is dropped multiple times on the control.
The same code with System.Windows.Forms works fine.
Is there a solution to achieve the same result as System.Windows.Forms ?
Here is my code of a test project which compares Telerik et System.Windows.Forms:
#region Telerik Drag&Drop
private void radTreeView1_ItemDrag(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
System.Diagnostics.Debug.WriteLine(String.Format("radTreeView1_ItemDrag : {0}", e.Node.Name));
DoDragDrop(e.Node, DragDropEffects.Move);
}
private void radTreeView2_DragEnter(object sender, DragEventArgs e)
{
System.Diagnostics.Debug.WriteLine(String.Format("radTreeView2_DragEnter : {0}", e.Effect));
if (e.Data.GetDataPresent("Telerik.WinControls.UI.RadTreeNode", true) == true)
{
e.Effect = DragDropEffects.Move;
}
}
private void radTreeView2_DragDrop(object sender, DragEventArgs e)
{
RadTreeNode node = e.Data.GetData(typeof(RadTreeNode)) as RadTreeNode;
if (node != null)
{
if (e.Effect == DragDropEffects.Move)
{
System.Diagnostics.Debug.WriteLine(String.Format("radTreeView2_DragDrop : {0}", e.Effect));
this.radTreeView2.Nodes.Add((node.Clone() as RadTreeNode));
}
}
}
#endregion Telerik Drag&Drop
#region System.Windows.Forms Drag&Drop
private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
{
System.Diagnostics.Debug.WriteLine(String.Format("treeView1_ItemDrag : {0}", (e.Item as TreeNode).Text));
DoDragDrop(e.Item, DragDropEffects.Move);
}
private void treeView2_DragEnter(object sender, DragEventArgs e)
{
System.Diagnostics.Debug.WriteLine(String.Format("treeView2_DragEnter : {0}", e.Effect));
if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", true) == true)
{
e.Effect = DragDropEffects.Move;
}
}
private void treeView2_DragDrop(object sender, DragEventArgs e)
{
TreeNode node = e.Data.GetData(typeof(TreeNode)) as TreeNode;
if (node != null)
{
if (e.Effect == DragDropEffects.Move)
{
System.Diagnostics.Debug.WriteLine(String.Format("treeView2_DragDrop : {0}", e.Effect));
this.treeView2.Nodes.Add((node.Clone()) as TreeNode);
}
}
}
private void bindingSource1_BindingComplete(object sender, BindingCompleteEventArgs e)
{
}
private void bindingSource1_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
{
this.treeView1.Nodes.Clear();
for (int i = 0; i < this.bindingSource1.Count; i++)
{
TreeNode node = new TreeNode((this.bindingSource1[0] as DataRowView).Row["C1"].ToString());
this.treeView1.Nodes.Add(node);
}
}
#endregion System.Windows.Forms Drag&Drop
Hello all!
I'm trying to create a custom GridViewRow so I can build in several of my own properties that will make my maintenance screens far easier to manage...so I went about doing this (in vb.net)
Friend Class DPSRow
Inherits GridViewRowInfo
Private _AttachmentType As AttachmentType
Public Property AttachmentType() As AttachmentType
Get
Return _AttachmentType
End Get
Set(ByVal value As AttachmentType)
_AttachmentType = value
End Set
End Property
Public Sub New(viewInfo As GridViewInfo, ByVal pAttachmentType As AttachmentType)
MyBase.New(viewInfo)
_AttachmentType = pAttachmentType
End Sub
End Class
My problem is the GridViewInfo. I'm pretty sure this object is part of the Grid hierarchy but for the life of me I can't figure out where it would be. Here's a sample of what I mean when trying to use the above - please note, my GridViewInfo reference is total garbage - I'm just putting it in here to illustrate my question:
Sub something()
Dim myAttachmentType as New AttachmentType(_ProjectID)
Dim myRow as New DPSRow(ATGrid.Something.Something.LastThing, myAttachmentType)
ATGrid.Rows.Add(myRow)
End Sub
In this code snippet, the object "LastThing" would be a GridViewInfo object which is required by the constructor of a GridViewRowInfo
Can anyone point me to where I can find this object among the pyramid that is my GridView control?
Any assistance would be very much appreciated!
Kindest regards,
CMS
I've got a grid cell that is painted with (or contains) an array of 0 - 4 icons which represent the methods in which a customer was contacted during a certain period.
At first I wanted to create an image and assign it to the cell's image property (seemed the easiest option) but it gave me 2 problems.
1) The cell insisted on displaying the image in the centre of the cell even though I'd told the image content to align left.
2) I couldn't think of a safe method to make sure the images are disposed of when no longer in use eg after paging/filtering/sorting etc.
So I thought that I'd use the cell paint event and paint an image to e.cell.graphics as I'd not need to do any memory management.
But there's little info in your help files about how to paint all the default parts of a cell. ie if one wanted to paint a default cell, but draw an image onto it so that selected colours, text fonts, back colour, theming etc etc etc looked the same on the cell. (Multi themed app)
In the microsoft grid view CellPaint event, there's a flag that the dev sets to say that painting has been done, to prevent infinite recursing. I've noticed that flag isn't in your grid view. I wondered how that effected the cell paint if you only wanted to paint a single column of the grid for example.