hi,
this is the code wat i am using in silverlight 4
foreach (DataGridColumn col in dgGrid1.Columns)
{
str = (string)col.Header;
if (str == "ID")
{
FrameworkElement cellContent = col.GetCellContent(e.Row);
DataGridCell cell = cellContent.Parent as DataGridCell;
}
}
in telerick
foreach (GridViewColumn col in RadGrid1.Columns)
{
str = (string)col.Header;
if (str == "ID")
{
// FrameworkElement cellContent = col.GetCellContent(e.Row);
// here we do not seems to have getcellContent(e.Row) value.
// wat is the alternative to archive this one.
GridViewCell cell = cellContent.Parent as GridViewCell;
}
}
any solution on this issue would be great
thanks
kumar
6 Answers, 1 is accepted
0
Hi kumar p,
Assuming you are trying to get the cell content by row and column,
You may use something like:
Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Assuming you are trying to get the cell content by row and column,
You may use something like:
foreach
(GridViewCell cell
in
e.row.Cells)
{
if
( cell.Column.UniqueName =
"ID"
;
var content = cell.Content;
}
Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
kumar p
Top achievements
Rank 1
answered on 26 May 2010, 03:22 PM
hi ,thanks for the replay.
to be clear this is what i am doing in SL 4
for only that particular column i trying an assign an event
where i am showing an pop up.
foreach (DataGridColumn col in dgGrid1.Columns)
{
str = (string)col.Header;
if (str == "ID")
{
FrameworkElement cellContent = col.GetCellContent(e.Row);
DataGridCell cell = cellContent.Parent as DataGridCell;
cell.MouseEnter -= cell_MouseEnter;
cell.MouseEnter += new MouseEventHandler(cell_MouseEnter);
cell.MouseLeave -= cell_MouseLeave;
cell.MouseLeave += new MouseEventHandler(cell_MouseLeave);
}
}
to be clear this is what i am doing in SL 4
for only that particular column i trying an assign an event
where i am showing an pop up.
foreach (DataGridColumn col in dgGrid1.Columns)
{
str = (string)col.Header;
if (str == "ID")
{
FrameworkElement cellContent = col.GetCellContent(e.Row);
DataGridCell cell = cellContent.Parent as DataGridCell;
cell.MouseEnter -= cell_MouseEnter;
cell.MouseEnter += new MouseEventHandler(cell_MouseEnter);
cell.MouseLeave -= cell_MouseLeave;
cell.MouseLeave += new MouseEventHandler(cell_MouseLeave);
}
}
0
Hi kumar p,
in the GridView.RowLoadedEvent handler
you can do somehting like :
foreach (GridViewCell in e.Row.Cells)
{
if( cell.column.Header = "ID")
{
cell.MouseEnter -= cell_MouseEnter;
cell.MouseEnter += new MouseEventHandler(cell_MouseEnter);
cell.MouseLeave -= cell_MouseLeave;
cell.MouseLeave += new MouseEventHandler(cell_MouseLeave);
}
}
Sincerely yours,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
in the GridView.RowLoadedEvent handler
you can do somehting like :
foreach (GridViewCell in e.Row.Cells)
{
if( cell.column.Header = "ID")
{
cell.MouseEnter -= cell_MouseEnter;
cell.MouseEnter += new MouseEventHandler(cell_MouseEnter);
cell.MouseLeave -= cell_MouseLeave;
cell.MouseLeave += new MouseEventHandler(cell_MouseLeave);
}
}
Sincerely yours,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
kumar p
Top achievements
Rank 1
answered on 26 May 2010, 05:02 PM
thanks for the support the code works fine but with one exception during the first time when page load i get an exception in this event
message:
" unable to cast object of type"telerik .windows.controls.gridview.gridviewheadercell to type telerik. windows.controls..gridview.gridviewcell'"
could you help me out.
message:
" unable to cast object of type"telerik .windows.controls.gridview.gridviewheadercell to type telerik. windows.controls..gridview.gridviewcell'"
could you help me out.
0
Accepted
Sunggoo Im
Top achievements
Rank 1
answered on 26 May 2010, 06:51 PM
if ((e.Row is GridViewHeaderRow) || (e.Row is GridViewFooterRow) || (e.Row is GridViewNewRow))
return;
will do.
0
kumar p
Top achievements
Rank 1
answered on 27 May 2010, 06:20 AM
thanks Sunggoo Im
for the support