3 Answers, 1 is accepted
0
Hi Jeff,
Thank you for writing.
Please note that you can use the CellClick event as well. The following snippet shows how you can check the template with both events:
Please let me know if there is something else I can help you with.
Regards,
Dimitar
Progress Telerik
Thank you for writing.
Please note that you can use the CellClick event as well. The following snippet shows how you can check the template with both events:
private
void
RadGridView1_MouseDown(
object
sender, MouseEventArgs e)
{
var cell = radGridView1.ElementTree.GetElementAtPoint(e.Location)
as
GridDataCellElement;
if
(cell !=
null
)
{
if
(cell.RowInfo.ViewTemplate == radGridView1.MasterTemplate)
{
Console.WriteLine(
"MasteTempalte"
);
}
else
{
Console.WriteLine(
"ChildTempalte"
);
}
}
}
private
void
RadGridView1_CellClick(
object
sender, GridViewCellEventArgs e)
{
if
(e.Row.ViewTemplate == radGridView1.MasterTemplate)
{
Console.WriteLine(
"MasteTempalte"
);
}
else
{
Console.WriteLine(
"ChildTempalte"
);
}
}
Please let me know if there is something else I can help you with.
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jeff
Top achievements
Rank 1
answered on 20 Jun 2017, 09:49 AM
We have multiple child grids (4 different levels). We need to know the GridControl pointer. MasterTemplate and ChildTemplate is not enough.
We need to get childtemplate cells header and values.
0
Hello Jeff,
I am not sure what you mean by saying GridControl pointer. You can get the parent control of any element like this:
In general, the ViewTemplate will contain the columns names, the rows, and all the information about the current child grid:
Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
I am not sure what you mean by saying GridControl pointer. You can get the parent control of any element like this:
var grid = cell.ElementTree.Control;
In general, the ViewTemplate will contain the columns names, the rows, and all the information about the current child grid:
private
void
RadGridView1_MouseDown(
object
sender, MouseEventArgs e)
{
var cell = radGridView1.ElementTree.GetElementAtPoint(e.Location)
as
GridDataCellElement;
if
(cell !=
null
)
{
foreach
(var item
in
cell.RowInfo.ViewTemplate.Columns)
{
Console.WriteLine(item.Name);
}
}
}
Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.