We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cells dont go out of ReadOnly mode

Thread ID:

Created:

Updated:

Platform:

Replies:

85056 Jul 3,2009 10:40 PM UTC Jul 10,2009 03:24 PM UTC WinForms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 3, 2009 10:40 PM UTC

Hi,

.Net Framework 2.0 , Syncfusion 7.103.0.30.

I have a Gridcontrol with editable cells, if i do gridControl1.Item(1, 1).ReadOnly = True it becomes readonly. But i cannot make it editable again even if i call gridControl1.Item(1, 1).ReadOnly = False.

This happens to any cell that i set to readonly = true, when i do that i can not bring it back to readonly = false no matter what i do.

Any ideas?

Lingaraj S [Syncfusion]
Replied On July 6, 2009 01:07 PM UTC

Hi,

Thank you for your interest in Syncfusion product.

If you want to set the ReadOnly cell in GridControl,then please try using QueryCellStyleInfo event in GridControl to achive this behaviour.

Please refer the code below:

Private flag As Boolean = True
Private Sub gridControl1_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.RowIndex = 1 AndAlso e.ColIndex = 1 Then
If flag Then
e.Style.ReadOnly = True
Else
e.Style.ReadOnly = False
End If
End If
End Sub


Refer the sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/forums/Grid.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

xx
Replied On July 6, 2009 11:33 PM UTC

Thanks for the reply.

It seems that wont work in this case as well, as I am trying to make a certain range in the row to be readonly = false.

example:

Private Sub gridTrips_CellDoubleClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs) Handles gridTrips.CellDoubleClick

For i = 1 To 9
gridTrips.Item(1, i).ReadOnly = False
gridTrips.Item(e.RowIndex, i).BackColor = Color.Yellow
Next

End Sub

----

I have also tried your code with "If e.RowIndex = 1 AndAlso e.ColIndex < 3 Then" but that affects the whole row not just cells 1 to 2.

What i do not understand is why in Syncfusion doing gridTrips.Item(1, 1).ReadOnly = True WORKS , but doing gridTrips.Item(1, 1).ReadOnly = false right after it DOES NOT.

A bug? Your comments and workarounds are much appreciated.

Administrator [Syncfusion]
Replied On July 8, 2009 11:50 PM UTC

Wondering if you missed this as there is alot of spam on the forums lately.

Lingaraj S [Syncfusion]
Replied On July 10, 2009 03:24 PM UTC

Hi,

Thank you for the update.

Setting something to ReadOnly will be ReadOnly even to the programmer. If you set _grid.ColStyles[1].BackColor = Color.Blue;, then this will not show blue in the

column since the styles were previously marked ReadOnly. So, to later set properties on readonly styles, you first must call grid.IgnoreReadonly = true;, make your

changes, and then reset IgnoreReadonly to false.

Refer the code below:

private void Form1_Load(object sender, EventArgs e)
{
this.gridControl1[1, 1].ReadOnly = true;
this.gridControl1[1, 2].ReadOnly = true;
}
private void button1_Click(object sender, EventArgs e)
{
this.gridControl1.IgnoreReadOnly = true ;
this.gridControl1[1, 1].ReadOnly = false;
this.gridControl1.IgnoreReadOnly = false;
}


Please let me know if you have any queries.Regards,
Lingaraj S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;