This is a migrated thread and some comments may be shown as answers.

Problem setting the default values to the GridViewDataColumn (Numeric Column).

0 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 25 May 2012, 01:37 PM

Hi,

I am using Telerik controls for Silverlight 5.

I have a custom DataGridNumericColumn class which inherits the GridViewDataColumn.

I am using this column to load the numeric values (properties with Integer data type) in the Grid. I wanted to set default values to this column in the add mode.

For this I have added a dependency property as below.

public int GridColumnDefaultValue
       {
           get { return (int)GetValue(GridColumnDefaultValueProperty); }
           set {SetValue(GridColumnDefaultValueProperty, value); }
       }
       
       public static readonly DependencyProperty GridColumnDefaultValueProperty =
                               DependencyProperty.Register("GridColumnDefaultValue", typeof(int), typeof(DataGridNumericColumn), new PropertyMetadata(null));

I am setting this GridColumnDefaultValue in the Grid and using this in the "AddingNewDataItem" event to set the defalut values.

I am setting the default value as below.

<MyControls:DataGridNumericColumn x:Name="Emp_id" GridColumnDefaultValue="1" DataMemberBinding="{Binding EMP_ID}" Header="EMP ID" Width="80"></MyControls:DataGridNumericColumn>

This is working well if we set this property with some value.

But I have some required fields and I dont want to show any value in those column. So in that case I am not setting this property.
But If I didnt set this property then it is setting the column values as "0".

How can I make it blank.

Please help.

Regards,
SivaPrasad.B

 

No answers yet. Maybe you can help?

Tags
GridView
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Share this question
or