All Products
Demos
Pricing
Services
Blogs
Docs & Support
Search
Shopping cart
Login
Contact Us
Get A Free Trial
close mobile menu
Telerik Forums
/
UI for WinForms Forum
/
GridView
/
Determine parent or child in CellEndEdit
Cancel
Telerik UI for WinForms
Resources
Buy
Try
Feed for this thread
3 posts, 0 answers
gerbrand
78 posts
Member since:
Mar 2009
Posted 07 May 2009
Link to this post
How can I determine if I'm editing a parent or a child in the radgrid?
I tried something like this:
private
void
radgrid_CellEndEdit(
object
sender, GridViewCellEventArgs e)
{
Console.WriteLine(
"cell edit"
);
if
(radgrid.Rows[e.RowIndex].ViewTemplate.Parent ==
null
)
{
Console.WriteLine(radgrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
}
else
{
var template = radgrid.MasterGridViewTemplate.ChildGridViewTemplates[0];
Console.WriteLine(template.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
}
}
But I'm keep going in the first part of my if statement.
Thanks
gerbrand
78 posts
Member since:
Mar 2009
Posted 07 May 2009
Link to this post
Okay,
I posted this a little to soon. I found a solution:
private
void
radgrid_CellEndEdit(
object
sender, GridViewCellEventArgs e)
{
Console.WriteLine(
"cell edit"
);
if
(radgrid.Rows[e.RowIndex].IsSelected
)
{
Console.WriteLine(radgrid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
}
else
{
var template = radgrid.MasterGridViewTemplate.ChildGridViewTemplates[0];
Console.WriteLine(template.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
}
}
But if there is a better solutions just let me know :-)
Nick
Admin
767 posts
Posted 07 May 2009
Link to this post
Hello gerbrand,
If the parent
ViewTemplate
is null, you are in the first level of the hierarchy:
ViewTemplate.Parent
== null
I hope this answers your question.
All the best,
Nick
the Telerik team
Instantly find answers to your questions on the new
Telerik Support Portal
.
Check out the tips
for optimizing your support resource searches.
Back to Top
Close