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

GridView CellEditTemplate doesn't work

1 Answer 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kelley Wong
Top achievements
Rank 1
Kelley Wong asked on 09 May 2011, 09:37 AM
When i update the produce,the GridView CellEditTemplate doesnot work

I want the Column of Score can be edited while the property of IsReadOnly of the gridview is set "true"

Before Update:
<telerik:RadGridView IsReadOnly="true" AutoGenerateColumns="false">
     <telerik:RadGridView.Columns>
           <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}"/>
           <telerik:GridViewDataColumn Header="Score"   DataMemberBinding="{Binding Score}">
                 <telerik:GridViewDataColumn.CellTemplate>
                       <DataTemplate>
                            <TextBlock Text="{Binding Score}" />
                        </DataTemplate>
                 </telerik:GridViewDataColumn.CellTemplate>
                 <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                              <TextBox Text="{Binding Score, Mode=TwoWay}" Loaded="Editor_Loaded" />
                         </DataTemplate>
                  </telerik:GridViewDataColumn.CellEditTemplate>
            </telerik:GridViewDataColumn>
      </telerik:RadGridView.Columns>
</telerik:RadGridView>

    public class Result: INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
  
        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
  
        public Result()
        {
  
        }
  
        /// <summary>
        /// 
        /// </summary>
        private string _Name ;
        [DataMember]
        public bool Name 
        {
            get
            {
                return _Name ;
            }
            set
            {
                _Name = value;
                NotifyPropertyChanged("Name ");
            }
        }
  
  
        /// <summary>
        /// 
         /// </summary>
        private decimal? _Score;
        [DataMember]
        public string Score
        {
            get
            {
                return _Score;
            }
            set
            {
                _Score= value;
                NotifyPropertyChanged("Score");
            }
        
   }
}


The Document says it has IsReadOnlyBinding property
so the new code i change as belows

<telerik:GridViewDataColumn Header="Score"   DataMemberBinding="{Binding Score}" IsReadOnlyBinding="{Binding CellIsReadOnly }"
                 <telerik:GridViewDataColumn.CellTemplate
                       <DataTemplate
                            <TextBlock Text="{Binding Score}" /> 
                        </DataTemplate
                 </telerik:GridViewDataColumn.CellTemplate
                 <telerik:GridViewDataColumn.CellEditTemplate
                        <DataTemplate
                              <TextBox Text="{Binding Score, Mode=TwoWay}" Loaded="Editor_Loaded" /> 
                         </DataTemplate
                  </telerik:GridViewDataColumn.CellEditTemplate
            </telerik:GridViewDataColumn


public class Result
{
      public bool CellIsReadOnly = false;
}

Could you tell me how to set one column of the gridview editable while the gridview's isreadonly is true

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 09 May 2011, 04:59 PM
Hi Kelley Wong,

 When the GridView is set to be ReadOnly, this is applicable to all its columns.

If you want to have only one Column that is editable, then you should have the IsReadOnly property of the GridView set to False, bind all the others columns to be IsReadOnly="True" ( IsReadOnlyBinding="{Binding CellIsReadOnly}", where CellIsReadOnly = true).

It is working like this with the current version of RadControls for Silverlight.

Regards,
Didie
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
Tags
GridView
Asked by
Kelley Wong
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or