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

Needs Solutions for these questions - DataBoundGrid

Hi Clay, Please answer to the below question. 1. We have description field in the grid which uses, RichText box. For each row, there will be drop down list arrow. But I do not want to display for each row down list arrow. My requirement is I need to showup the RichText Box as soon as a single character is typed into a description field, or when the edit function key is pressed i.e. Press F3). 2. How do we change the key in the richtext box. Example. currently the key is used to allow a description to go to acorss multiple lines. But we’d prefer that the key close richtext box instead of clicking on ''OK'' button. Where a description should be broken up over more than one line, we could allow a different keystroke as etc. How do we implement this? Thanks Satish

16 Replies

AD Administrator Syncfusion Team June 10, 2004 03:58 AM

Here is a KB that has code for a in-place editable richtext cell. Maybe this will serve your needs better than the cell that requires the dropdown. http://www.syncfusion.com/Support/article.aspx?id=10495


SA Satish June 10, 2004 04:41 AM

Hi Clay, This is simply great. thanks sending me the link. But this is unable to run in my machine. Please find the attached error. Thanks Satish >Here is a KB that has code for a in-place editable richtext cell. Maybe this will serve your needs better than the cell that requires the dropdown. > >http://www.syncfusion.com/Support/article.aspx?id=10495 RichTextError_1921.zip


SA Satish June 10, 2004 04:56 AM

Hi Clay, I could able to solve previous problem. I ran into another problem. Please find the attached one. Why all the richtext is showing exception??? I cannot use the arrow keys to move around the text? Thanks Satish >Hi Clay, >This is simply great. thanks sending me the link. >But this is unable to run in my machine. >Please find the attached error. >Thanks >Satish > > > >>Here is a KB that has code for a in-place editable richtext cell. Maybe this will serve your needs better than the cell that requires the dropdown. >> >>http://www.syncfusion.com/Support/article.aspx?id=10495 > >RichTextError_1921.zip > > ExceptionError_2158.zip


AD Administrator Syncfusion Team June 10, 2004 05:06 AM

Did you make any changes to th esample? What version of the our libraries are you using? The sample runs fine for me using 2.0.5.1. The red boxes indicate that an exception is being thrown during the painting of the cell. You should check the richtext that you are trying to display to see if it is valid.


SA Satish June 10, 2004 05:15 AM

Hi Clay, No I didn''t made any changes to the sample application. I am using 2.0.5.1 with 2003 .net version. I checked this in two machine, but the results are same. Please suggest any other alternatives for this. thanks Satish >Did you make any changes to th esample? What version of the our libraries are you using? > >The sample runs fine for me using 2.0.5.1. > >The red boxes indicate that an exception is being thrown during the painting of the cell. You should check the richtext that you are trying to display to see if it is valid.


AD Administrator Syncfusion Team June 10, 2004 06:59 AM

The sample downloads and runs fine here (on several systems). What operation system are you using?


SA Satish June 10, 2004 09:08 PM

I am using win2K. Thanks Satish >The sample downloads and runs fine here (on several systems). > >What operation system are you using?


AD Administrator Syncfusion Team June 11, 2004 01:56 AM

I see the problem on Win2K. In the renderer class constructor, there is a line: this.Model.ButtonBarSize = new Size(0,0); change it to this.Model.ButtonBarSize = new Size(1,1);


AD Administrator Syncfusion Team June 11, 2004 04:34 AM

To handle the arrow keys within the richtextbox while it is active, you need to add some code to OnKeyDown in the renderer. Here is an updated sample. RichTextInPlaceCellContol_7936.zip


SA Satish June 11, 2004 04:41 AM

Hi Clay, Thanks for your mail. Great support and its worked. Sorry. I have some more requirements like 1. I need to use arrow''s in the richtext box, which is currenlty not possible. 2. When i select something and click on delete, whole content in the richtext box will get deleted. But I need to delete only the text which is selected. 3. I think third question is familiar to you that is the Autosize. I want auto size rather than the scorll bar. Thanks Satish >I see the problem on Win2K. > >In the renderer class constructor, there is a line: > >this.Model.ButtonBarSize = new Size(0,0); > >change it to > >this.Model.ButtonBarSize = new Size(1,1); >


AD Administrator Syncfusion Team June 11, 2004 04:54 AM

Did you try 1 & 2 in the sample I just posted in the thread?. When the RichText cell is actively being edited 1 & 2 work as expected for me in this sample. I have no solution for 3.


SA Satish June 11, 2004 05:03 AM

Clay, Too many Thanks. Everythning worked except 3point. I will try or wait for your early respone in near future. Thanks Satish >Did you try 1 & 2 in the sample I just posted in the thread?. > >When the RichText cell is actively being edited 1 & 2 work as expected for me in this sample. > >I have no solution for 3.


AD Administrator Syncfusion Team June 11, 2004 06:03 AM

There will be no full solution for 3 as the Win32 RichText control does not have any autosizing API''s exposed. So you will have to implement special solutions based on what you want. Here is one attempt (its not perfect) to allow sizing of richtext using grid.Model.RowHeights.ResizeToFit. It does not try to support colwidth sizing. You would add this override to the cell model class.
private RichTextBox rtb = new RichTextBox();
public override Size CalculatePreferredCellSize(Graphics g, int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
{
	Size clientSize =  base.CalculatePreferredCellSize (g, rowIndex, colIndex, style, queryBounds);
	if(style.CellValue != null)
	{	
		rtb.Rtf = style.CellValue.ToString();
		int height = 0;
		int start = rtb.TextLength;
		rtb.SelectionLength = 0;
		int line = rtb.GetLineFromCharIndex(start);
		while(start >= 0 && line == rtb.GetLineFromCharIndex(start))
		{
			height = Math.Max(height, rtb.GetPositionFromCharIndex(start).Y);// + rtb.SelectionFont.Height + 1);
			start -= 1;
		}
		clientSize = new Size(clientSize.Width, height);
		return clientSize;
}


AD Administrator Syncfusion Team June 11, 2004 06:12 AM

Instead of looping in the above snippet, you can just use the last character.
if(style.CellValue != null)
{	
	rtb.Rtf = style.CellValue.ToString();
	int height = 0;
	int start = rtb.TextLength;
	height = Math.Max(height, rtb.GetPositionFromCharIndex(start).Y);
	clientSize =  new Size(clientSize.Width, height);
}


AD Administrator Syncfusion Team June 13, 2004 05:18 PM

Here is a new sample that includes some support for sizing rowheights. RichTextInPlaceCellContol_3502.zip


SA Satish June 13, 2004 10:18 PM

Hi Clay, Great Support. Thanks For all your support. Thanks Satish >Here is a new sample that includes some support for sizing rowheights. > >RichTextInPlaceCellContol_3502.zip > >

Loader.
Live Chat Icon For mobile
Up arrow icon