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. Image for the cookie policy date

GGC Autosize TextBox

Hi,

just one question:

I have an data table with a desciption (text) field which is shown in the GGC. Now I can enter the text into the grid - but:

1. it won't accept the enter-key for a new line
2. it is not adjusting the height of the row automatically

I tried to set up this behaviour in the "TableDescriptor\Columns\"Description"\Appearance\AnyRecordFieldCell"-Property by setting AllowEnter and Autosize. But it unfortunately has no effect.

Anybody an idea?

Thanks in advance!

Best Regards
Martin


3 Replies

AD Administrator Syncfusion Team March 17, 2008 08:11 AM UTC

Hi Martin,

Thank you for using Syncfusion products.

1. GridGrouping Control won't accept the enter-key for a new line

By default, the GridGrouping Control allows to use enter for new line character. Could you please modify the below sample to reproduce the issue or send us the sample with the issue, so that we could provide you the exact solution early?

Here is sample:

'>http://websamples.syncfusion.com/samples/Grouping.Windows/F72355/main.htm">
http://websamples.syncfusion.com/samples/Grouping.Windows/F72355/main.htm

2. GridGrouping Control is not adjusting the height of the row automatically

You can try handling the QueryCellStyleInfo event. But calling the ReSizeToFit method in the QueryCellStyleInfo event makes the recursive call. So you can set the RowHeight of the cell by using the CalculatePreferredCellSize method. You can refer the below forum thread for more details.

Here is the forum thread link:


http://www.syncfusion.com/support/forums/message.aspx?MessageID=60375

Please let me know if you have any questions.

Regards,
Subhasheela R






MH Martin Hagenow March 17, 2008 01:04 PM UTC

Hi,


By default, the GridGrouping Control allows to use enter for new line character.


Sorry, my fault I meant a new line in the textbox not in the Grid!

I want to enter a large amount of text into one cell. These shall include "\r". (Multiline textbox accepting "Enter")

I set the style of the Grid: \Appearance\AnyCell\AllowEnter=true but when I hit the enter key while editing the text the grid enters a new line and not the textbox.

Thanks in Advance!

Cheers,

Martin



AD Administrator Syncfusion Team March 24, 2008 11:44 AM UTC


Hi Martin,

Sorry for the delay in getting back to you.

You can allow enter by setting WantEnterKey and AllowTextBoxAutoSize properties of GridGrouping Control. Also you can handle QueryCellStyleInfo event to set the AllowEnter, AutoSize and WrapText properties. Below is the code snippet:

this.gridGroupingControl1.TableControl.WantEnterKey = false;
this.gridGroupingControl1.TableControl.AllowTextBoxAutoSize = true;
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.ColIndex == 2 && e.TableCellIdentity.RowIndex > 0)
{
e.Style.BackColor = Color.Pink;
e.Style.AllowEnter = true;
e.Style.AutoSize = true;
e.Style.WrapText = true;
}
}


Here is the sample:

'>http://websamples.syncfusion.com/samples/Grouping.Windows/F72355FollowUp1/main.htm">
http://websamples.syncfusion.com/samples/Grouping.Windows/F72355FollowUp1/main.htm

Please let me know if it helps.

Regards,
Subhasheela R




Loader.
Live Chat Icon For mobile
Up arrow icon