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
close icon

AddNewRecord Row

Hi,

I am wondering if I can modify the appearance of the "AddNewRecord" row. So I want the AddNewRecord row to be only one cell (merge all columns in that row) and the row should be read only. When the user clicks on that row a dialog opens to add a new item (row) to the grid. So that the main purpose of this row is to open a dialog. The row should also contain some text e.g. "Click here to add a new record".

Is this possible with syncfusion?

A small example would be great.

Cheers,
Carl

6 Replies

RA Rajagopal Syncfusion Team June 22, 2007 07:19 PM UTC

Hi Carl,

This can be done by handling a couple of events in grid. Using the CoveredRanges method of the TableModel, all the cells in the addnewrecord can be made to look as a single cell. Please refer to the sample below that does what you have described.

Here is the sample download link
http://websamples.syncfusion.com/samples/Grid.Windows/F62828/main.htm

Thanks for your interest in Syncfusion Products.

Have a nice time.
Regards,
Rajagopal


CA Carl June 25, 2007 09:09 AM UTC

Hi Rajagopal,

thank you for your reply. I have modified your sample so that it fits to our approach. When you run the sample and click on the "Fill Table" button you will get an exception.

Can you tell me what's wrong here?

Cheers

GGC_AddNewRec1.zip


CA Carl June 25, 2007 08:39 PM UTC

Hi,

any news on that issue?

Cheers,
Carl


CA Carl June 27, 2007 04:44 PM UTC

Hi,

its me again, just wanna know if you have any updates on this issue. Currently we are stuck at the new record row problem.

Thanks,
Carl


CA Carl July 4, 2007 09:02 AM UTC

Hi,

any news on that issue - it would be great if you can help us here - we are still locking for a workaround.

Best regards,
Carl


HA haneefm Syncfusion Team July 4, 2007 06:49 PM UTC

Hi Carl,

My sincere apologies for this delay in responding.

The reason is that you are setting the Style.CellValue for the AddNewRecord cell in a QueryCellStyleInfo event. Instead of setting the CellValue of the AddNewRecordCell, try hanlding the TableControlDrawCell event to draw the AddNewRecordCell manually. Below are the code snippet to show this task.


void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo styleInfo = (GridTableCellStyleInfo)e.Inner.Style;
if (styleInfo.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.AddNewRecord
&& e.Inner.ColIndex > 0 )
{
e.Inner.Renderer.Draw(e.Inner.Graphics, e.Inner.Bounds, e.Inner.RowIndex, e.Inner.ColIndex, e.Inner.Style);
e.Inner.Graphics.DrawString("Click Here to add a new record", new Font("Arial", 10f), Brushes.Blue, e.Inner.Bounds);
e.Inner.Cancel = true;
}
}

Please refer to the attached sample for modification and let me know if this helps.
ModifiedGGC_AddNewRec1.zip

Many thanks for your patience.

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon