Hello telerik Team,
I have one clarification.
I have a master page with 5 controls Including Gender Name(Male,Female). The Gender Name designed in UI as combo box.data type is declared as boolean in both Business layer as well as database.
My problem is particularly about GenderName field
I want to display all details in radgridview from database.In database GenderName is stored as boolean .but i want to display in grid male or female(that is text only not boolean).
How to do that one?
I have one clarification.
I have a master page with 5 controls Including Gender Name(Male,Female). The Gender Name designed in UI as combo box.data type is declared as boolean in both Business layer as well as database.
My problem is particularly about GenderName field
I want to display all details in radgridview from database.In database GenderName is stored as boolean .but i want to display in grid male or female(that is text only not boolean).
How to do that one?
6 Answers, 1 is accepted
0
Hi sivakanth,
Maya
the Telerik team
You may use an IValueConverter and convert the boolean property to Male/Female strings.
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

sivakanth
Top achievements
Rank 1
answered on 10 Feb 2011, 10:33 AM
Hello Maya
I am also using converter here.But after that the column will nothing to display.
In this sample where i mistake?
if i use wpf datagrid(microsoft datagrid) mean it will display correctly. but radgrid not display?
if i mistake any place kindly inform to me?
I am also using converter here.But after that the column will nothing to display.
This is my XAML Code.Its contains two columns.Customer ID and GenderName
<
Window.Resources
>
<
local:BooleanConverter
x:Key
=
"Formatter"
/>
</
Window.Resources
>
<
telerik:RadGridView
AutoGenerateColumns
=
"False"
CanUserFreezeColumns
=
"False"
CanUserReorderColumns
=
"False"
CanUserResizeColumns
=
"False"
IsTabStop
=
"False"
Name
=
"radGridView1"
VerticalAlignment
=
"Top"
Width
=
"454"
Height
=
"149"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Customer ID"
DataMemberBinding
=
"{Binding CompanyID}"
Width
=
"120"
/>
<
telerik:GridViewDataColumn
Header
=
"Gender Name"
DataMemberBinding
=
"{Binding Path=GenderName,Converter={StaticResource GenderName,Mode=TwoWay}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
This is my converter class.
class BooleanConverter:IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string returnValue = string.Empty;
if ((bool)value ==true)
{
returnValue = "Male";
return(string)returnValue;
}
else
{
returnValue = "Female";
return (string)returnValue;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
if i use wpf datagrid(microsoft datagrid) mean it will display correctly. but radgrid not display?
if i mistake any place kindly inform to me?
0
Hi sivakanth,
Kind regards,
Maya
the Telerik team
Looking at your code, I have found a small mistake in the definition of the GenderName column. You need to change the setting of the Converter:
<
telerik:GridViewDataColumn
Header
=
"Gender Name"
DataMemberBinding
=
"{Binding Path=GenderName,Converter={StaticResource Formatter, Mode=TwoWay}"
/>
Kind regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

sivakanth
Top achievements
Rank 1
answered on 10 Feb 2011, 11:28 AM
Hello Maya,
I am accept my mistake.Its happen when am copy and paste on forums.I am already cheching in that way also.
but still it display nothing?
i have one doupt also.Normally radgrid display boolean values check box format only?
but datagrid display true,false. how can i display true,false(string) in rad grid.
if i get answer this question i solved my problem.
I am accept my mistake.Its happen when am copy and paste on forums.I am already cheching in that way also.
but still it display nothing?
i have one doupt also.Normally radgrid display boolean values check box format only?
but datagrid display true,false. how can i display true,false(string) in rad grid.
if i get answer this question i solved my problem.
0
Hi sivakanth,
Maya
the Telerik team
I am sending you a sample project illustrating how you may convert a boolean property from the business object to a Male/ Female value.
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

sivakanth
Top achievements
Rank 1
answered on 10 Feb 2011, 01:32 PM
Hello Maya,
Thank you for your quick reply.I want this only.
Thank you for your quick reply.I want this only.