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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGrouping Control, Read only Rows

Thread ID:

Created:

Updated:

Platform:

Replies:

20415 Oct 17,2004 09:43 PM UTC Oct 19,2004 05:33 AM UTC Windows Forms 3
loading
Tags: Grouping
Paul
Asked On October 17, 2004 09:43 PM UTC

Hi, I want to know how you set rows to be read only. I know I can set columns to read only using: Me.groupingdatagrid1.TableDescriptor.Columns.Item(0).ReadOnly = True but i can''t seem to find any way to make rows read only. If any of you know, please let me know. Thanks, Paul

Administrator [Syncfusion]
Replied On October 18, 2004 07:27 PM UTC

You can do this handling QueryCellStyleInfo. In the handler, explicitly set e.Style.ReadOnly = true based on whatever criteria you need. This code sets a row readonly is the AAs field value is AAA4.
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
	if(e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell
		|| e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
	{
		GridTableDescriptor td = this.gridGroupingControl1.TableDescriptor;
		GridRecordRow rec = e.TableCellIdentity.DisplayElement as GridRecordRow;
		if(rec != null)
		{
			DataRowView drv = rec.GetData() as DataRowView;
			if(drv != null && drv["AAs"].ToString() == "AA4")
			{
				e.Style.ReadOnly = true;
			}
		}
	}
}

Paul
Replied On October 19, 2004 01:35 AM UTC

Thanks for the function. I couldnt port it to VB.net, could you paste in a vb version?? also, will this work with a currency field. Thanks

Administrator [Syncfusion]
Replied On October 19, 2004 05:33 AM UTC

It should work for any cell type. Here is a link that does a pretty good job of converting C# to VB. http://authors.aspalliance.com/aldotnet/examples/translate.aspx
Private Sub gridGroupingControl1_QueryCellStyleInfo(sender As Object, e As GridTableCellStyleInfoEventArgs)
   If e.TableCellIdentity.TableCellType = GridTableCellType.RecordFieldCell Or e.TableCellIdentity.TableCellType = GridTableCellType.AlternateRecordFieldCell Then
      Dim td As GridTableDescriptor = Me.gridGroupingControl1.TableDescriptor
      Dim rec As GridRecordRow = e.TableCellIdentity.DisplayElement ''
      If Not (rec Is Nothing) Then
         Dim drv As DataRowView = rec.GetData() ''
         If Not (drv Is Nothing) And drv("AAs").ToString() = "AA4" Then
            e.Style.ReadOnly = True
         End If
      End If
   End If
End Sub ''gridGroupingControl1_QueryCellStyleInfo

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

;