How is the information provided by the Info property?
Specifically, when the info states:
"(GridAddNewRecord): Field1 = 109, Field2 = -1, Field3 = , Field4 = "
how can I access these field values?
Glenn
BE
Ben
April 29, 2004 02:24 PM UTC
Well that property is a string and is comma delimited. I''d recommend using the GetData method which returns an object. What are you using as a datasource? If you''re using a dataset GetData returns a DataRowView. Hope this helps.
Ben
GL
glenn
April 29, 2004 03:37 PM UTC
Thats the problem, I have tried using the GetData but cannot seem to find a way to retrieve a field value for the AddNewRecord row in a child table in the QueryCellStyleInfo event.
The info property in the local window shows the fields and the values if any.
>Well that property is a string and is comma delimited. I''d recommend using the GetData method which returns an object. What are you using as a datasource? If you''re using a dataset GetData returns a DataRowView. Hope this helps.
>
>Ben
BE
Ben
April 29, 2004 04:08 PM UTC
This should work
Engine engine = gridgroupcontrol.Engine;
Table pTable = engine.Table;
CurrentRecordManager crm = pTable.CurrentRecordManager;
DataRowView dv =(DataRowView) crm.CurrentElement.ParentRecord.GetData();
BE
Ben
April 29, 2004 04:10 PM UTC
I''m not sure if my suggestion is the most efficient but it''s what I''m using, I have multiple child tables, other option is to look at this KB article
http://www.syncfusion.com/Support/article.aspx?id=10466
AD
Administrator
Syncfusion Team
April 29, 2004 04:25 PM UTC
For the AddNewRecord the GetData() method will return null since the data of that record have not been added to the underlying dataview.
To get to any value of a Record or AddNewRecord you can use record.GetValue("FieldName");
That will return individual fields from the record. If changes have been made to the record and they have not been commited to the dataview (EndEdit was not called), then the modified value will be returned.
Stefan
GL
glenn
April 29, 2004 04:58 PM UTC
Thanks Ben & Stefan - This helped!!!
>For the AddNewRecord the GetData() method will return null since the data of that record have not been added to the underlying dataview.
>
>To get to any value of a Record or AddNewRecord you can use record.GetValue("FieldName");
>
>That will return individual fields from the record. If changes have been made to the record and they have not been commited to the dataview (EndEdit was not called), then the modified value will be returned.
>
>Stefan
>