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

[Solved] Do not Set IsEnabled of GridViewCell is False?

3 Answers 87 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sun
Top achievements
Rank 1
sun asked on 24 Dec 2009, 09:53 AM
Before I set  IsEnabled of GridViewCell  is False , then i Use  RadGridView.Rebind() ,so I find IsEnabled of GridViewCell  is True! 
is this bug?

Code:
   (gridview.ItemContainerGenerator.ContainerFromIndex(1) as GridViewRow).Cells[1].IsEnabled=False;
    gridview.Rebind();
//So  i  see (gridview.ItemContainerGenerator.ContainerFromIndex(1) as GridViewRow).Cells[1].IsEnabled is True 

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 28 Dec 2009, 09:21 AM
Hello sun,

This is an expected behavior. When the Rebind() method is called , all the cells are recreated so you get new cells with their default settings.  Can you please give me some more details on your scenario so we can find some descent workaround.

Regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
sun
Top achievements
Rank 1
answered on 29 Dec 2009, 01:31 AM
Thanks for you help! 
        I would like to set up a cell non-editable In the same column, But when the Rebind() method is called ,the cell has been set up well there could be edited ! How do I set up a cell non-editable In the same column after the Rebind() method is called?
0
Pavel Pavlov
Telerik team
answered on 29 Dec 2009, 10:12 AM
Hi sun,

A possible solution is to subscribe to the RadGridView.RowLoaded event . Then within the event handler find the cell and set IsEnabled to false.
Here is some sample code :
/For example if we need to disable the cell with index 1 /
public MainPage()
{
    InitializeComponent();
    this.radGrid1.RowLoaded += new EventHandler<Telerik.Windows.Controls.GridView.RowLoadedEventArgs>(radGrid1_RowLoaded);
}
void radGrid1_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
    e.Row.Cells[1].IsEnabled = false;
}


Let me know if you find any troubles adapting this to your project.

Greetings,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
sun
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
sun
Top achievements
Rank 1
Share this question
or