Hi
I’m very new with the telerik, I’m trying to find a control from radGridview.I implements in .Net Grid control ( sample code is given below) But I cant do the same in radGridView. Can anyone give me any idea to implement this in radGridview. I need your help.
Code snippets:
foreach (GridViewRow row in dgrdInbox.Rows)
{
CheckBox cbBox = (CheckBox)row.FindControl("cbYesNo");
if (cbYesOrNo.Checked)
{
// Do something
}
else
{
// Do something
}
}
Thanks in advanced.
Md. Marufuzzaman
4 Answers, 1 is accepted
0
Hello Johny,
Thank you for supplied code snippet.
Presently, the controls in the suite do not use other controls to achieve their functionality. They use special elements of type RadElement. It is the basic object in Telerik Presentation Framework used for implementation of RadControls for Winforms. You can read more about TPF in this documentation article.
The fastest approach to get the desired value of specified column for each row is to go through the collection of Rows of the grid. You can use the following code snippet as sample:
If you have further questions feel free to write us back.
Sincerely yours,
Svett
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.
Thank you for supplied code snippet.
Presently, the controls in the suite do not use other controls to achieve their functionality. They use special elements of type RadElement. It is the basic object in Telerik Presentation Framework used for implementation of RadControls for Winforms. You can read more about TPF in this documentation article.
The fastest approach to get the desired value of specified column for each row is to go through the collection of Rows of the grid. You can use the following code snippet as sample:
foreach
(GridViewDataRowInfo dataRow
in
this
.radGridView.Rows)
{
bool
value = Convert.ToBoolean(dataRow.Cells[
"BoolColumn"
].Value);
if
(value)
{
// TO DO: Your code when the value is true
}
else
{
// TO DO: Your code when the value is false
}
}
If you have further questions feel free to write us back.
Sincerely yours,
Svett
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
Johny
Top achievements
Rank 2
answered on 29 Mar 2010, 03:41 PM
Hi
Svett:
Thanks for your reply with sample code snippets, probably there is an issue of NULL value, this code will throw an exception when
the
Thanks for your reply with sample code snippets, probably there is an issue of NULL value, this code will throw an exception when
the
dataRow.Cells[
"BoolColumn"
].Value is NULL. Actually I'm facing an error that is (exception = {"Object cannot be cast from DBNull to other types."}). Any suggestion for this
Thanks
Md. Marufuzzaman
0
Accepted
Hi Johny,
Thank you for the clarification. You are receiving this exception because the Boolean cell for the specified row has a null value. Hence, .NET Framework Convert class throws exception. Therefore, you can modify the code snippet as it is shown below:
If you need further assistance, do not hesitate to ask.
Greetings,
Svett
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.
Thank you for the clarification. You are receiving this exception because the Boolean cell for the specified row has a null value. Hence, .NET Framework Convert class throws exception. Therefore, you can modify the code snippet as it is shown below:
foreach
(GridViewDataRowInfo dataRow
in
this
.radGridView.Rows)
{
bool
value =
false
;
if
(dataRow.Cells[
"BoolColumn"
].Value !=
null
&& !(dataRow.Cells[
"BoolColumn"
].Value
is
DBNull))
{
value = Convert.ToBoolean(dataRow.Cells[
"BoolColumn"
].Value);
}
if
(value)
{
// TO DO: Your code when the value is true
}
else
{
// TO DO: Your code when the value is false
}
}
If you need further assistance, do not hesitate to ask.
Greetings,
Svett
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
Johny
Top achievements
Rank 2
answered on 01 Apr 2010, 03:12 PM
Hi
Svett:
Thanks a lot :)
Regards,
Md. Marufuzzaman
Thanks a lot :)
Regards,
Md. Marufuzzaman