I have a RadGridView bound to a DataTable. When I add a new rows of data to the DataTable, they parent row in the hierarchy does not display the expand / contract graphic by default. It does appear after I click on the RadGridView however. I tried using:
this.radGridView.Invalidate();
to force a redraw but it does not work.
[Update]
Attached is a screenshot. The top image represents the grid when row is added to datatable, the bottom image represents the grid when the user selects a cell from the grid.
this.radGridView.Invalidate();
to force a redraw but it does not work.
[Update]
Attached is a screenshot. The top image represents the grid when row is added to datatable, the bottom image represents the grid when the user selects a cell from the grid.
36 Answers, 1 is accepted
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 11 Jan 2011, 09:09 PM
Hello Mark,
Yes, it should indeed show the image when you add a new row. Please could you try the following in a new project. It's just a RadGridView on a form and let me know if that's working for you
If it is, then the following would be helpful to know.
Yes, it should indeed show the image when you add a new row. Please could you try the following in a new project. It's just a RadGridView on a form and let me know if that's working for you
Imports
Telerik.WinControls.UI
Public
Class
Form1
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
Me
.RadGridView1.AllowAddNewRow =
True
Me
.RadGridView1.AddNewRowPosition = SystemRowPosition.Top
creatingHierarchicalGridInUnboundMode()
End
Sub
Public
Sub
creatingHierarchicalGridInUnboundMode()
'setup the master template
Dim
textColumn
As
New
GridViewTextBoxColumn(
"Name"
)
textColumn.Width = 150
RadGridView1.MasterTemplate.Columns.Add(textColumn)
RadGridView1.MasterTemplate.Columns.Add(
New
GridViewDecimalColumn(
"Salary"
))
Dim
dateTimeColumn
As
New
GridViewDateTimeColumn(
"Hire Date"
)
dateTimeColumn.Width = 100
dateTimeColumn.TextAlignment = ContentAlignment.MiddleCenter
RadGridView1.MasterTemplate.Columns.Add(dateTimeColumn)
textColumn =
New
GridViewTextBoxColumn(
"Title"
)
textColumn.Width = 150
RadGridView1.MasterTemplate.Columns.Add(textColumn)
RadGridView1.MasterTemplate.Columns.Add(
New
GridViewCheckBoxColumn(
"Active"
))
'setup the child template
Dim
template
As
New
GridViewTemplate()
template.AllowAddNewRow =
True
template.Columns.Add(
New
GridViewTextBoxColumn(
"Name"
))
template.Columns.Add(
New
GridViewTextBoxColumn(
"Product Number"
))
template.Columns.Add(
New
GridViewDecimalColumn(
"Quantity"
))
template.Columns.Add(
New
GridViewDecimalColumn(
"Discount"
))
template.Columns.Add(
New
GridViewDecimalColumn(
"Total"
))
RadGridView1.MasterTemplate.Templates.Add(template)
'create the relation
Dim
relation
As
New
GridViewRelation(RadGridView1.MasterTemplate)
relation.ChildTemplate = template
relation.RelationName =
"EmployeesOrders"
relation.ParentColumnNames.Add(
"Name"
)
relation.ChildColumnNames.Add(
"Name"
)
RadGridView1.Relations.Add(relation)
End
Sub
End
Class
If it is, then the following would be helpful to know.
- What version of the controls you are using
- The theme you have applied
- How you are binding and creating your hierarchy
- Any other special conditions.
Thanks
Richard
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 09:22 PM
Thanks! I will attempt this now and get back to you.
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 09:32 PM
I'm using c# for my project, forgot to mention.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 11 Jan 2011, 09:46 PM
Hi Mark,
Here is the same thing in C#.
Regards,
Richard
Here is the same thing in C#.
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
namespace
RadGridView_hierarchy_C
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
this
.Load +=
new
System.EventHandler(
this
.Form1_Load);
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
creatingHierarchicalGridInUnboundMode();
}
public
void
creatingHierarchicalGridInUnboundMode()
{
//setup the master template
GridViewTextBoxColumn textColumn =
new
GridViewTextBoxColumn(
"Name"
);
textColumn.Width = 150;
radGridView1.MasterTemplate.Columns.Add(textColumn);
radGridView1.MasterTemplate.Columns.Add(
new
GridViewDecimalColumn(
"Salary"
));
GridViewDateTimeColumn dateTimeColumn =
new
GridViewDateTimeColumn(
"Hire Date"
);
dateTimeColumn.Width = 100;
dateTimeColumn.TextAlignment = ContentAlignment.MiddleCenter;
radGridView1.MasterTemplate.Columns.Add(dateTimeColumn);
textColumn =
new
GridViewTextBoxColumn(
"Title"
);
textColumn.Width = 150;
radGridView1.MasterTemplate.Columns.Add(textColumn);
radGridView1.MasterTemplate.Columns.Add(
new
GridViewCheckBoxColumn(
"Active"
));
//setup the child template
GridViewTemplate template =
new
GridViewTemplate();
template.AllowAddNewRow =
true
;
template.Columns.Add(
new
GridViewTextBoxColumn(
"Name"
));
template.Columns.Add(
new
GridViewTextBoxColumn(
"Product Number"
));
template.Columns.Add(
new
GridViewDecimalColumn(
"Quantity"
));
template.Columns.Add(
new
GridViewDecimalColumn(
"Discount"
));
template.Columns.Add(
new
GridViewDecimalColumn(
"Total"
));
radGridView1.MasterTemplate.Templates.Add(template);
//create the relation
GridViewRelation relation =
new
GridViewRelation(radGridView1.MasterTemplate);
relation.ChildTemplate = template;
relation.RelationName =
"EmployeesOrders"
;
relation.ParentColumnNames.Add(
"Name"
);
relation.ChildColumnNames.Add(
"Name"
);
radGridView1.Relations.Add(relation);
}
}
}
Regards,
Richard
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 10:35 PM
Ok, I've tried that, but unfortunately the grid is not bound to a DataTable.
Here is example code to reproduce the issue I am having:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace RadGridView_hierarchy_C
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load += new System.EventHandler(this.Form1_Load);
}
private void Form1_Load(object sender, EventArgs e)
{
creatingHierarchicalGridInUnboundMode();
}
public void creatingHierarchicalGridInUnboundMode()
{
DataTable liveData = new DataTable("MonitoringSymbols");
liveData.Columns.Add("ID", typeof(int));
liveData.Columns.Add("ParentID", typeof(int));
liveData.Columns.Add("Symbol", typeof(string));
liveData.Columns.Add("Start Time", typeof(string));
liveData.Columns.Add("End Time", typeof(string));
liveData.Columns.Add("Depth", typeof(string));
liveData.Columns.Add("Min Bid", typeof(string));
liveData.Columns.Add("Max Bid", typeof(string));
this.radGridView1.DataSource = liveData;
GridViewRelation selfRelaction = new GridViewRelation(this.radGridView1.MasterTemplate, this.radGridView1.MasterTemplate);
selfRelaction.ParentColumnNames.Add("ID"); selfRelaction.ChildColumnNames.Add("ParentID");
this.radGridView1.Relations.Add(selfRelaction);
//this.AddSymbol(symbol_names, symbol_ids, symbol_pips, startTime, endTime);
this.radGridView1.Columns["ID"].IsVisible = false;
this.radGridView1.Columns["ParentID"].IsVisible = false;
liveData.Rows.Add(1, null, "AUD/CAD", "12/20/2010 12:28:15 PM", "12/20/2010 3:28:15 PM", "1", "1.0098", "1.01261");
liveData.Rows.Add(2, 1, "AUD/CAD", "12/20/2010 12:28:15 PM", "12/20/2010 3:28:15 PM"," 2", "1.00978", "1.01258");
liveData.Rows.Add(3, 1, "AUD/CAD", "12/20/2010 12:28:15 PM", "12/20/2010 3:28:15 PM", "3", "1.00961", "1.01258");
}
}
}
Here is example code to reproduce the issue I am having:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace RadGridView_hierarchy_C
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load += new System.EventHandler(this.Form1_Load);
}
private void Form1_Load(object sender, EventArgs e)
{
creatingHierarchicalGridInUnboundMode();
}
public void creatingHierarchicalGridInUnboundMode()
{
DataTable liveData = new DataTable("MonitoringSymbols");
liveData.Columns.Add("ID", typeof(int));
liveData.Columns.Add("ParentID", typeof(int));
liveData.Columns.Add("Symbol", typeof(string));
liveData.Columns.Add("Start Time", typeof(string));
liveData.Columns.Add("End Time", typeof(string));
liveData.Columns.Add("Depth", typeof(string));
liveData.Columns.Add("Min Bid", typeof(string));
liveData.Columns.Add("Max Bid", typeof(string));
this.radGridView1.DataSource = liveData;
GridViewRelation selfRelaction = new GridViewRelation(this.radGridView1.MasterTemplate, this.radGridView1.MasterTemplate);
selfRelaction.ParentColumnNames.Add("ID"); selfRelaction.ChildColumnNames.Add("ParentID");
this.radGridView1.Relations.Add(selfRelaction);
//this.AddSymbol(symbol_names, symbol_ids, symbol_pips, startTime, endTime);
this.radGridView1.Columns["ID"].IsVisible = false;
this.radGridView1.Columns["ParentID"].IsVisible = false;
liveData.Rows.Add(1, null, "AUD/CAD", "12/20/2010 12:28:15 PM", "12/20/2010 3:28:15 PM", "1", "1.0098", "1.01261");
liveData.Rows.Add(2, 1, "AUD/CAD", "12/20/2010 12:28:15 PM", "12/20/2010 3:28:15 PM"," 2", "1.00978", "1.01258");
liveData.Rows.Add(3, 1, "AUD/CAD", "12/20/2010 12:28:15 PM", "12/20/2010 3:28:15 PM", "3", "1.00961", "1.01258");
}
}
}
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 11 Jan 2011, 10:50 PM
Hi Mark,
No, I left out binding any data. Please can you try adding a new row and seeing if the + appears?
I'll have a look at your sample too.
Thanks
Richard
No, I left out binding any data. Please can you try adding a new row and seeing if the + appears?
I'll have a look at your sample too.
Thanks
Richard
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 10:52 PM
Just to clarify, add a new row to your code or my code?
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 11 Jan 2011, 11:05 PM
Hi Mark,
To mine. I am currently looking at your one. In yours, it crashes when trying to add a new row.
Richard
To mine. I am currently looking at your one. In yours, it crashes when trying to add a new row.
Richard
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 11:13 PM
Interesting, I don't get any exceptions or errors from my code. Are you using 4.0? It might help to make the liveData object a class variable in scope.
When I add a row to yours, the +- box does appear. Could you walk me through creating the RadGridView and relationship between columns such that the rows and columns align, and the columns are the same among parent and child.
When I add a row to yours, the +- box does appear. Could you walk me through creating the RadGridView and relationship between columns such that the rows and columns align, and the columns are the same among parent and child.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 11 Jan 2011, 11:25 PM
Hi Mark,
IYes, I'm using .NET 4.0, and the latest version of the RadControls. I will prepare this for you as soon as possible. May be in the morning now as it's pretty late at night here now. Will get back to you as soon as I can.
All the best
Richard
IYes, I'm using .NET 4.0, and the latest version of the RadControls. I will prepare this for you as soon as possible. May be in the morning now as it's pretty late at night here now. Will get back to you as soon as I can.
All the best
Richard
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 11:28 PM
What error are you getting from my code?
No problem, thanks for all the help.
No problem, thanks for all the help.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 11 Jan 2011, 11:39 PM
Hi Mark,
I wasn't getting an error. It would just freeze when trying to adjust the column widths or add a new row. Here is a brief sample though which should help you out. Let me know if you need anything further though.
Best regards,
Richard
I wasn't getting an error. It would just freeze when trying to adjust the column widths or add a new row. Here is a brief sample though which should help you out. Let me know if you need anything further though.
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
namespace
RadGridView_hierarchy_C
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
this
.Load +=
new
System.EventHandler(
this
.Form1_Load);
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
creatingHierarchicalGridInUnboundMode();
}
public
void
creatingHierarchicalGridInUnboundMode()
{
DataTable parentData =
new
DataTable(
"MonitoringSymbolsParents"
);
parentData.Columns.Add(
"ID"
,
typeof
(
int
));
parentData.Columns.Add(
"Symbol"
,
typeof
(
string
));
parentData.Columns.Add(
"Start Time"
,
typeof
(
string
));
parentData.Columns.Add(
"End Time"
,
typeof
(
string
));
parentData.Columns.Add(
"Depth"
,
typeof
(
string
));
parentData.Columns.Add(
"Min Bid"
,
typeof
(
string
));
parentData.Columns.Add(
"Max Bid"
,
typeof
(
string
));
DataTable childData =
new
DataTable(
"MonitoringSymbolsChildren"
);
childData.Columns.Add(
"ID"
,
typeof
(
int
));
childData.Columns.Add(
"ParentID"
,
typeof
(
int
));
childData.Columns.Add(
"Symbol"
,
typeof
(
string
));
childData.Columns.Add(
"Start Time"
,
typeof
(
string
));
childData.Columns.Add(
"End Time"
,
typeof
(
string
));
childData.Columns.Add(
"Depth"
,
typeof
(
string
));
childData.Columns.Add(
"Min Bid"
,
typeof
(
string
));
childData.Columns.Add(
"Max Bid"
,
typeof
(
string
));
this
.radGridView1.DataSource = parentData;
GridViewTemplate template =
new
GridViewTemplate();
template.DataSource = childData;
radGridView1.MasterTemplate.Templates.Add(template);
GridViewRelation relation =
new
GridViewRelation(radGridView1.MasterTemplate);
relation.ChildTemplate = template;
relation.RelationName =
"MyRelation"
;
relation.ParentColumnNames.Add(
"ID"
);
relation.ChildColumnNames.Add(
"ParentID"
);
radGridView1.Relations.Add(relation);
// parent data
parentData.Rows.Add(1,
"AUD/CAD Parent"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
,
"1"
,
"1.0098"
,
"1.01261"
);
parentData.Rows.Add(2,
"AUD/CCC Parent"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
,
" 2"
,
"1.00978"
,
"1.01258"
);
parentData.Rows.Add(3,
"AUD/DDD Parent"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
,
"3"
,
"1.00961"
,
"1.01258"
);
// child data
childData.Rows.Add(1, 1,
"AUD/CAD Child"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
,
"1"
,
"1.0098"
,
"1.01261"
);
childData.Rows.Add(2, 1,
"AUD/CAD Child"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
,
" 2"
,
"1.00978"
,
"1.01258"
);
childData.Rows.Add(3, 1,
"AUD/CAD Child"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
,
"3"
,
"1.00961"
,
"1.01258"
);
this
.radGridView1.MasterTemplate.Columns[
"ID"
].IsVisible =
false
;
this
.radGridView1.Templates[0].Columns[
"ID"
].IsVisible =
false
;
this
.radGridView1.Templates[0].Columns[
"ParentID"
].IsVisible =
false
;
}
}
}
Best regards,
Richard
0

Mark
Top achievements
Rank 1
answered on 11 Jan 2011, 11:44 PM
I'll give it a go tomorrow as well.
0

Mark
Top achievements
Rank 1
answered on 12 Jan 2011, 07:11 PM
It looks like I may be able to work with this. Any tips for getting the columns aligned on the parent child, or at least hiding the column headers on the child groups?
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 12 Jan 2011, 08:11 PM
Hi Mark,
To hide the column headers on the child grid, set the ShowColumnHeaders property on the child template.
In terms of aligning, it will do this automatically and give you the correct editor for the type. So for your integers, E.g.
and ints will be right aligned and the editor for them will be the Spin Editor, rather than the text editor that is meant for strings.
If you need further help though, just let me know
Regards,
Richard
To hide the column headers on the child grid, set the ShowColumnHeaders property on the child template.
// Hide Child Column Headers
this
.radGridView1.Templates[0].ShowColumnHeaders =
false
;
In terms of aligning, it will do this automatically and give you the correct editor for the type. So for your integers, E.g.
childData.Columns.Add(
"Depth"
,
typeof
(
int
));
// should be an int
childData.Rows.Add(1, 1,
"AUD/CAD Child"
,
"12/20/2010 12:28:15 PM"
,
"12/20/2010 3:28:15 PM"
, 1,
"1.0098"
,
"1.01261"
);
// pass in depth as int
If you need further help though, just let me know
Regards,
Richard
0

Mark
Top achievements
Rank 1
answered on 12 Jan 2011, 08:21 PM
The show column property worked.
However, I should have been more clear when describing the column alignment. My grid is such that each row that is collapsed or expanded has the same columns as the parent row. However, the columns widths do not line up parent to child. There are some other less than desirable visuals occurring. Here is a screen shot of what I see with my current code.
However, I should have been more clear when describing the column alignment. My grid is such that each row that is collapsed or expanded has the same columns as the parent row. However, the columns widths do not line up parent to child. There are some other less than desirable visuals occurring. Here is a screen shot of what I see with my current code.
0

Mark
Top achievements
Rank 1
answered on 12 Jan 2011, 09:42 PM
Also, when I try to read the expanded and collapsed values to export in the same order they are displayed, or would be displayed if they were expanded, I am having difficulty.
foreach (Telerik.WinControls.UI.GridViewRowInfo dr in this.radGridView.Rows)
{
outputBuffer.Add(string.Format("{0},{1},{2},{3}", dr.Cells["Symbol"].Value.ToString(), dr.Cells["Start Time"].Value.ToString(), dr.Cells["End Time"].Value.ToString(), dr.Cells["Depth"].Value.ToString());
}
This only displays Rows that are visible in the RadGridView, and not the collapsed rows. When I had it bound to a single DataTable, the export was simpler. Is it required that databinding be done with multiple DataTables, because I don't exactly see why my version was bad?
foreach (Telerik.WinControls.UI.GridViewRowInfo dr in this.radGridView.Rows)
{
outputBuffer.Add(string.Format("{0},{1},{2},{3}", dr.Cells["Symbol"].Value.ToString(), dr.Cells["Start Time"].Value.ToString(), dr.Cells["End Time"].Value.ToString(), dr.Cells["Depth"].Value.ToString());
}
This only displays Rows that are visible in the RadGridView, and not the collapsed rows. When I had it bound to a single DataTable, the export was simpler. Is it required that databinding be done with multiple DataTables, because I don't exactly see why my version was bad?
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 12 Jan 2011, 10:25 PM
Hello Mark,
to get everything to line up means that you will need to make the column widths the same for both the child and master template columns. Then it would be best to remove the thick border that is on the child rows. Please can you try the following:
I'll look at your other question too.
Regards,
Richard
to get everything to line up means that you will need to make the column widths the same for both the child and master template columns. Then it would be best to remove the thick border that is on the child rows. Please can you try the following:
// Hide Child Column Headers
this
.radGridView1.Templates[0].ShowColumnHeaders =
false
;
// Set to fill (as per Marks screenshot)
this
.radGridView1.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this
.radGridView1.Templates[0].AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
// get rid of the border to help alignment
this
.radGridView1.ViewCellFormatting +=
new
Telerik.WinControls.UI.CellFormattingEventHandler(
this
.radGridView1_ViewCellFormatting);
// Set all column widths
foreach
(GridViewColumn parentColumn
in
this
.radGridView1.MasterTemplate.Columns)
{
if
(parentColumn.IsVisible)
{
parentColumn.Width = 50;
parentColumn.MinWidth = 50;
}
}
foreach
(GridViewColumn childColumn
in
this
.radGridView1.Templates[0].Columns)
{
if
(childColumn.IsVisible)
{
childColumn.Width = 50;
childColumn.MinWidth = 50;
}
}
private
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
// get rid of the thick border
if
(e.CellElement
is
GridDetailViewCellElement)
{
GridDetailViewCellElement cell = (GridDetailViewCellElement)e.CellElement;
cell.Padding =
new
Padding(0);
}
}
I'll look at your other question too.
Regards,
Richard
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 12 Jan 2011, 10:33 PM
Hi Mark,
In order to loop over the rows (no matter how it was bound) if you have a hierarchy grid then you will need to inspect the parent row to see if there are any child rows. So, for your "Symbol Column" to output all the values in order, including child rows.
Hope that helps
Richard
In order to loop over the rows (no matter how it was bound) if you have a hierarchy grid then you will need to inspect the parent row to see if there are any child rows. So, for your "Symbol Column" to output all the values in order, including child rows.
foreach
(GridViewRowInfo parentRow
in
this
.radGridView1.Rows)
{
MessageBox.Show(parentRow.Cells[
"Symbol"
].Value.ToString());
if
(parentRow.ChildRows.Count > 0)
{
foreach
(GridViewRowInfo childRow
in
parentRow.ChildRows)
{
MessageBox.Show(childRow.Cells[
"Symbol"
].Value.ToString());
}
}
}
Hope that helps
Richard
0

Mark
Top achievements
Rank 1
answered on 12 Jan 2011, 11:54 PM
Thank you! The output is now iterating through the Child rows properly.
However, the code provided here: does now appear to be working properly:
The condition is never true and the padding is never set to 0.
However, the code provided here: does now appear to be working properly:
private
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
// get rid of the thick border
if
(e.CellElement
is
GridDetailViewCellElement)
{
GridDetailViewCellElement cell = (GridDetailViewCellElement)e.CellElement;
cell.Padding =
new
Padding(0);
}
}
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 01:11 AM
Hi Mark,
Just to confirm, the event declaration is there too?
Regards,
Richard
Just to confirm, the event declaration is there too?
this
.radGridView1.ViewCellFormatting +=
new
Telerik.WinControls.UI.CellFormattingEventHandler(
this
.radGridView1_ViewCellFormatting);
Richard
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 05:11 PM
Yes, the event is fired, but that condition is never true.
is always false.
(e.CellElement
is
GridDetailViewCellElement)
is always false.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 06:01 PM
Hi Mark,
To clarify, the condition will not be hit if all rows are collapsed. If you expand a row, then it will be hit.
Let me know if you're still having issues
Richard
To clarify, the condition will not be hit if all rows are collapsed. If you expand a row, then it will be hit.
Let me know if you're still having issues
Richard
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 06:09 PM
I'm sorry, I double checked and the condition is never true whether or expanded or collapsed.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 06:15 PM
Hello,
I'd suggest upgrading to the latest version if you're not already on it,
Could you also try removing the condition, and that should give the same effect for what you're doing..
Hope this helps
Richard
I'd suggest upgrading to the latest version if you're not already on it,
Could you also try removing the condition, and that should give the same effect for what you're doing..
private
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
e.CellElement.Padding =
new
Padding(0);
// get rid of the thick border
//if (e.CellElement is GridDetailViewCellElement)
//{
// GridDetailViewCellElement cell = (GridDetailViewCellElement)e.CellElement;
// cell.Padding = new Padding(0);
//}
}
Richard
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 06:30 PM
I tried this and still not working.
I just want to clarify that we are talking about the same unexpected behavior.
I have a thick blue border around the perimeter of all of the cells in the expanded portion. Not each individual cell.
I just want to clarify that we are talking about the same unexpected behavior.
I have a thick blue border around the perimeter of all of the cells in the expanded portion. Not each individual cell.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 06:33 PM
Hello Mark,
Yes, the thick blue border around the whole of the child area. See screenshot that I attached above.
Please can you confirm which version of the controls you are using
Richard
Yes, the thick blue border around the whole of the child area. See screenshot that I attached above.
Please can you confirm which version of the controls you are using
Richard
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 06:35 PM
And please could you also post your event handler and event declaration
thanks
Richard
thanks
Richard
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 06:36 PM
2010.2.10.806
v2.0.50727
v2.0.50727
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 06:40 PM
this.radGridView.ViewCellFormatting += new Telerik.WinControls.UI.CellFormattingEventHandler(RadGridView_ViewCellFormatting);
private void RadGridView_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
if(e.CellElement is Telerik.WinControls.UI.GridHeaderCellElement)
{
e.CellElement.ForeColor = Color.Silver;
e.CellElement.BackColor2 = Color.Silver;
e.CellElement.BackColor = Color.Black;
e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Linear;
e.CellElement.DrawBorder = false;
e.CellElement.DrawFill = true;
e.CellElement.NumberOfColors = 2;
}
e.CellElement.Padding = new Padding(0);
}
private void RadGridView_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
if(e.CellElement is Telerik.WinControls.UI.GridHeaderCellElement)
{
e.CellElement.ForeColor = Color.Silver;
e.CellElement.BackColor2 = Color.Silver;
e.CellElement.BackColor = Color.Black;
e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Linear;
e.CellElement.DrawBorder = false;
e.CellElement.DrawFill = true;
e.CellElement.NumberOfColors = 2;
}
e.CellElement.Padding = new Padding(0);
}
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 06:41 PM
Hi Mark,
I'd certainly say that upgrading is the best option. Unfortunatly, i don't have an old version of the controls that I can try this with but I can't think of a reason why it shouldn't work. If you post your code, I'll take a look.
thanks
Richard
I'd certainly say that upgrading is the best option. Unfortunatly, i don't have an old version of the controls that I can try this with but I can't think of a reason why it shouldn't work. If you post your code, I'll take a look.
thanks
Richard
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 09:47 PM
Hi Mark,
for reference, the screenshot attached is what I see after applying your ViewCellFormatting code
Richard
for reference, the screenshot attached is what I see after applying your ViewCellFormatting code
Richard
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 09:59 PM
I think it is a fair assumption to say that since we don't have the same version, but have the same application code, the version is a likely culprit.
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 10:22 PM
Hi Mark,
I'd really like to try and get this right for you. Could you try one more thing.
In your ViewCellformatting event can you add the following (this doesn't compile for me due to my version, but I it may for you)
thanks
Richard
I'd really like to try and get this right for you. Could you try one more thing.
In your ViewCellformatting event can you add the following (this doesn't compile for me due to my version, but I it may for you)
e.CellElement.ChildTableElement.DrawBorder =
false
;
e.CellElement.ChildTableElement.TableBodyElement.DrawBorder =
false
;
e.CellElement.ChildTableElement.Paddng.All = 0;
thanks
Richard
0

Mark
Top achievements
Rank 1
answered on 13 Jan 2011, 10:26 PM
Thank you very much, I will have to give it a go tomorrow, though. I moved on to an urgent issue that should be resolved today.
0

Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 10:31 PM
Ok. Good luck. If you need anything else, just let me know
Richard
Richard