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

GridView IsReadOnly not working

4 Answers 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rogério
Top achievements
Rank 1
Rogério asked on 02 Jun 2009, 04:42 PM
Hello,

I'm using RadGridView in a lot of places! Normaly my grids start in "IsReadOnly" mode and change to editable mode in some cases!

The problem is that any RadGridView that IsReadOnly is set as true, if we try to set the property as false, cell never become editable!!
This is a very big issue for may application!!!

Is there any workaround to this issue?

Thanks.

Best Regards,
Rogério

4 Answers, 1 is accepted

Sort by
0
Vlad
Top achievements
Rank 1
answered on 03 Jun 2009, 03:42 AM
Hi,

Can you refer to some of our examples where this can be reproduced? If you post a bit more info about your scenario and how to grid is bound in your case I will gladly help you.

Vlad
0
Rogério
Top achievements
Rank 1
answered on 03 Jun 2009, 08:02 AM
Hi,

Here you have a sample piece of code to reproduce the issue!

... 
    <Grid x:Name="LayoutRoot" Background="White"
        <Grid.RowDefinitions> 
            <RowDefinition /> 
            <RowDefinition /> 
        </Grid.RowDefinitions> 
        <StackPanel Grid.Row="0"
            <Button Content="SET ReadOnly" Click="Button_Click" /> 
            <Button Content="SET Editable" Click="Button_Click_1" /> 
            <TextBox Height="10" x:Name="txtbox"></TextBox> 
        </StackPanel> 
         
        <grid:RadGridView x:Name="grid" Grid.Row="1" ></grid:RadGridView> 
    </Grid> 
... 


    public partial class MainPage : UserControl 
    { 
        public MainPage() 
        { 
            InitializeComponent(); 
 
            List<MyData> list = new List<MyData>(); 
 
            MyData item = new MyData(); 
            item.Name = "aaaaa"
            item.Age = 10; 
 
            MyData item2 = new MyData(); 
            item2.Name = "bbbbb"
            item2.Age = 20; 
 
            list.Add(item); 
            list.Add(item2); 
 
            grid.IsReadOnly = true;             
            grid.ItemsSource = list; 
        } 
 
        private void Button_Click(object sender, RoutedEventArgs e) 
        { 
            grid.IsReadOnly = true;            
        } 
 
        private void Button_Click_1(object sender, RoutedEventArgs e) 
        { 
            grid.IsReadOnly = false;             
        } 
    } 
    public class MyData 
    { 
        public string Name { setget; } 
        public int Age { setget; } 
    } 

Regards,
Rogério

0
Vlad
Telerik team
answered on 03 Jun 2009, 09:16 AM
Hi Rogério,

Unfortunately you are right - the bug was identified and will be fixed immediately.
In the meantime I suggest you following workaround:
public partial class Page : UserControl 
    { 
        public Page() 
        { 
            InitializeComponent(); 
 
            List<MyData> list = new List<MyData>(); 
 
            MyData item = new MyData(); 
            item.Name = "aaaaa"
            item.Age = 10; 
 
            MyData item2 = new MyData(); 
            item2.Name = "bbbbb"
            item2.Age = 20; 
 
            list.Add(item); 
            list.Add(item2); 
 
            grid.ItemsSource = list; 
 
            grid.Columns.OfType<GridViewColumn>().ToList().ForEach(c => c.IsReadOnly = true); 
        } 
 
        private void Button_Click(object sender, RoutedEventArgs e) 
        { 
            grid.Columns.OfType<GridViewColumn>().ToList().ForEach(c=>c.IsReadOnly = true); 
        } 
 
        private void Button_Click_1(object sender, RoutedEventArgs e) 
        { 
            grid.Columns.OfType<GridViewColumn>().ToList().ForEach(c => c.IsReadOnly = false); 
        }  
    } 
 

Please excuse us for this temporary inconvenience!

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rogério
Top achievements
Rank 1
answered on 03 Jun 2009, 10:03 AM
Hi,

Sorry, but your workarround is not working! When I click cell it becomes editable even if I set Column as read-only!

Regards,
Rogério
Tags
GridView
Asked by
Rogério
Top achievements
Rank 1
Answers by
Vlad
Top achievements
Rank 1
Rogério
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or