6 Answers, 1 is accepted
0
Hello Naser,
Thank you for writing.
There is a way to access the visual cell elements by using the GetCellElement method of the TableElement. Please note that, using the visual cells is usually not recommended because the visual cells are being reused by the UI virtualization of the grid and you can easily end up reading incorrect cell value.
I hope this helps.
Greetings,
Stefan
the Telerik team
Thank you for writing.
There is a way to access the visual cell elements by using the GetCellElement method of the TableElement. Please note that, using the visual cells is usually not recommended because the visual cells are being reused by the UI virtualization of the grid and you can easily end up reading incorrect cell value.
I hope this helps.
Greetings,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Naser
Top achievements
Rank 1
answered on 05 Sep 2012, 06:37 PM
Hi.
I have a method that must return a GridViewCellInfo parameter text. how can I do it.
I have a method that must return a GridViewCellInfo parameter text. how can I do it.
public static string GetRadCellText(GridViewCellInfo gridViewCellInfo)
{
//TO DO : here must be a code that return text of cell
}
0
Accepted
Hello Naser,
Here are two possible implementations depending for a scenario where you modify the cell text and where you do not modify the cell text:
I hope this helps.
Regards,
Stefan
the Telerik team
Here are two possible implementations depending for a scenario where you modify the cell text and where you do not modify the cell text:
public
string
GetRadCellText(GridViewCellInfo gridViewCellInfo)
{
return
gridViewCellInfo.Value.ToString();
//if not modified the value will be the same as the text
//or
GridCellElement cellElement = radGridView1.TableElement.GetCellElement(gridViewCellInfo.RowInfo, gridViewCellInfo.ColumnInfo);
return
cellElement.Text;
//this returns the cell text (if it is modified in the cell formatting event it will not equal the cell value)
}
I hope this helps.
Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Naser
Top achievements
Rank 1
answered on 07 Sep 2012, 05:17 PM
Thanks you,
I need and tested second way, but
radGridView1.TableElement.GetCellElement(gridViewCellInfo.RowInfo, gridViewCellInfo.ColumnInfo);
get a null value , so I can't got text of cellElement.
I need and tested second way, but
radGridView1.TableElement.
get a null value , so I can't got text of cellElement.
0
Accepted
Hi Naser,
As GridCellElement is a visual element, you should pass a reference to a visible cell to make sure that the method will return correct results.
Could you please provide me with a small sample of your project and let me know what are your exact requirements so I can point you to the right direction.
All the best,
Stefan
the Telerik team
As GridCellElement is a visual element, you should pass a reference to a visible cell to make sure that the method will return correct results.
Could you please provide me with a small sample of your project and let me know what are your exact requirements so I can point you to the right direction.
All the best,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Naser
Top achievements
Rank 1
answered on 10 Sep 2012, 05:33 PM
Hi.
Thank you very much.
your answer (
Thank you very much.
your answer (
GridCellElement cellElement = radGridView1.TableElement.GetCellElement(gridViewCellInfo.RowInfo, gridViewCellInfo.ColumnInfo);
return
cellElement.Text; )
was correct.