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

GridGroupingControl - AutoSize of RecordPreviewCell

Thread ID:

Created:

Updated:

Platform:

Replies:

37702 Nov 29,2005 10:35 AM UTC Nov 29,2005 03:25 PM UTC WinForms 9
loading
Tags: GridControl
Badri Rajani Kanth
Asked On November 29, 2005 10:35 AM UTC

Hi, in my GGC, I am displaying RecordPreviewCell for each row. But text in RecordPreviewCell can be of any lenght for each record. So, I want to enable autosize property. I tried with below given code. Not woring yet. Can any body plz look into inform why itz not working? Having scrollbar in that cell is my last option. private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { switch (e.TableCellIdentity.TableCellType) { case GridTableCellType.RecordPreviewCell: { string str1 = "test line1 \ntest line 2 \ntest line 3\ntest line4 \ntest line 5 \ntest line 6 ";//record.GetValue("Notes").ToString(); e.Style.Text = str1; e.Style.VerticalScrollbar = true; e.Style.WrapText = true; e.Style.AutoSize = true; gridGroupingControl1.TableModel.RowHeights.ResizeToFit( GridRangeInfo.Cell(e.TableCellIdentity.RowIndex, e.TableCellIdentity.ColIndex), GridResizeToFitOptions.IncludeHeaders); break; } } }

Administrator [Syncfusion]
Replied On November 29, 2005 11:51 AM UTC

The style.AutoSize property only affects cells as your user types into them. It will not autosize display only text which is likely what you have. You should not be calling RowHeights.ResizeToFit in QueryCellStyeInfo. This would be a performance issue. Normally, the preview row height is set using this property.

Badri Rajani Kanth
Replied On November 29, 2005 11:58 AM UTC

Hi Thanks! Which property? height? Then it is height is fixed and I cant have dynamic and different heights for different preview rows. Isn''t it? Rgds Rajani Kanth >The style.AutoSize property only affects cells as your user types into them. It will not autosize display only text which is likely what you have. > >You should not be calling RowHeights.ResizeToFit in QueryCellStyeInfo. This would be a performance issue. > >Normally, the preview row height is set using this property. >

Badri Rajani Kanth
Replied On November 29, 2005 12:10 PM UTC

Hi, It would be fine even If i can add RichTextBox into this preview cell as a control. Cause I can enable scroll bars on RichTextBox and display read-only data. Is there any limitation again? Rgds Rajani Kanth

Administrator [Syncfusion]
Replied On November 29, 2005 12:11 PM UTC

Sorry. It is this property. this.gridGroupingControl1.TableOptions.RecordPreviewRowHeight And this sets it for all preview rows.

Badri Rajani Kanth
Replied On November 29, 2005 12:16 PM UTC

Hi, It would be fine even If i can add RichTextBox into this preview cell as a control. Cause I can enable scroll bars on RichTextBox and display read-only data. Is there any limitation again? Rgds Rajani Kanth >Sorry. It is this property. > >this.gridGroupingControl1.TableOptions.RecordPreviewRowHeight > > >And this sets it for all preview rows.

Administrator [Syncfusion]
Replied On November 29, 2005 01:36 PM UTC

Here is code that showed scrollbars for me when I clicked a row preview cell (provided the whole row is visible).
case GridTableCellType.RecordPreviewCell:
{
	GridGroupingControl groupingControl = (GridGroupingControl) sender;
	GridTable table = groupingControl.Table;
	GridRecord record = e.TableCellIdentity.DisplayElement.ParentRecord as GridRecord;
	if (record != null)
		e.Style.CellValue = record.GetValue("Notes").ToString();
	else
		e.Style.CellValue = "No Notes.";
	e.Style.VerticalScrollbar = true;
	e.Style.WrapText = true;
	e.Style.CellType = "TextBox";
	e.Style.ReadOnly = true;
	e.Style.Enabled = true;
	break;
}

Badri Rajani Kanth
Replied On November 29, 2005 02:04 PM UTC

Hi, I tried this ealier. But the problem with this is, when the row text is formatted, like e.Style.CellValue = "test line1 \ntest line 2 \ntest line 3\ntest line4 \ntest line 5 \ntest line 6 "; we will loose all the format. That is why I am trying to see if I can add any ritch text box. I see some examples like that. But could not add for preview row. Is there any catch? Rgds Rajani Kanth

Badri Rajani Kanth
Replied On November 29, 2005 02:30 PM UTC

Hi, with the code given below: string str1 = "test line1 \ntest line 2 \ntest line 3\ntest line4 \ntest line 5 \ntest line 6 ";//record.GetValue("Notes").ToString(); e.Style.VerticalScrollbar = true; e.Style.WrapText = true; e.Style.CellType = "RichText"; e.Style.ReadOnly = true; e.Style.Enabled = true; e.Style.ApplyFormattedText(str1); I can display ritch text box. But thought this is read-only, I am getting editing kind of window with Save & Cancel buttons. All I want for my application is, 1. To dispplay pre-view row with any text (formatted) and of any length. If the text is more, I want to show scrollbars. Is it possible? And this should be read-only. Rgds Rajani Kanth

Administrator [Syncfusion]
Replied On November 29, 2005 03:25 PM UTC

You can hide the button by setting e.Style.ShowButton = GridShowButtons.Hide. But this will not get you the scrollbar you want to see arbitary length text in this cell. If you want RichText (as opposed to a TextBox), I think you will have to use the richtext celltype discussed in this KB. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=71 Here is a sample. Search for MyRichText in the form to see that code that was added to the standard sample. http://www.syncfusion.com/Support/user/uploads/CS_8ae748f8.zip If you do not need RichText, then you are do things simpler just setting the properties in the QueryCellStyleInfo and not having to add a custom celltype.

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

;