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

Set GridViewRows to Readonly

0 Answers 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Shaimaa
Top achievements
Rank 1
Shaimaa asked on 04 Apr 2012, 09:01 AM
Hello,

I wanted to set a few rows in my grid to readonly...I did not see the Readonly property for a row...
I got a piece of code which successfully disable my rows....but it's nt exactly what i wanted.

Code :

 

 

public void MakeExistingRowsReadOnly()

 

{

 

 

if (this.Items.ItemCount != 0)

 

{

 

 

for (int i = 0; i < this.Items.Count; i++)

 

{

 

 

GridViewRow currentrow = (GridViewRow)this.ItemContainerGenerator.ContainerFromItem(this.Items[i]);

 

 

 

if (!currentrow.Equals(null))

 

{

currentrow.IsEnabled =

 

false;

 

 

}

}

}

}


With this code...it disables the rows completely. The user can copy a cell etc.
what i want to achieve ios that...when the user is in the add mode...certain rows only are ReadOnly whereby he won't be able to enter values in that row. But he can copy data from the Readonly rows, can navigate etc.

Right now with this code, navigation and copying the data has been lost.

Can anyone please help...How can we make rows Readonly...without losing other features?

Regards
Shaimaa

No answers yet. Maybe you can help?

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