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

Get the GridRows Collection

Hi,
I want to make code in such a way that I will edit the GGC first or delete row etc. Then I will press the save button and then I want the gridrow collection so that I can update/insert one by one in the database . I have not found any way of getting gridrow collection. Can u please help me further.
Thanks.

8 Replies

SI Sivakumar Syncfusion Team September 7, 2006 07:43 PM UTC

Hi Sandeep,


Are you looking for something similar like our ''EditAllRows'' sample?.

please have a look at this sample under ''Grid.Grouping.web ->Editing->EditAllRows'' category in our
online demo 
.

This sample also ships with our EssentialGrid Install and you can view this sample at the following location.

{InstalledLocation}\Web\grid.grouping.web\Samples\2.0\Editing\EditAllRows

In the above mentioned sample we Parse through all the rows in the grid table when clicking on the SaveChanges button.

But If you just want to access only the current record''s value , i.e editing and saving only one record,
then please use the following code in your button click event

[C#]

this.GridGroupingControl1.Table.CurrentRecord.GetValue("Id").ToString();

Let us know if you have any queries.

Thanks,
A.Sivakumar


SA Sandeep September 8, 2006 12:41 PM UTC

Hi Sivakumar,
Thanks for updates. I went through the EditAllRows Sample. Actually I want the collection of GridRows so that I can go through it one by one for some calculation part. In EditAllRows you have already used GridGroupingControl1.TopLevelTable property to get the table, and using that we can get one by one gridrow too. But Now I am facing problem that, I am getting TopLevelTable as undefined (null). Here I am binding the GGC using DataTable.
Please tell me where I am getting wrong.Or what I need to do so that I can get TopLevelTable properly.

Thanks.
Sandeep


SI Sivakumar Syncfusion Team September 8, 2006 05:13 PM UTC

Hi Sandeep,

The GridGroupingControl1.TopLevelTable property can be used only when the grid is already in edit mode.
i.e when you click the save button the edited records value can be changed according to your calculations
inside the button click event.

'' I think I wrongly assumed that your records will be in edit mode when you click the save button.''

From your previous post description it seems like are trying to get the records from the records rows and use it for some
calculations. ( I am still not pretty sure about the scenario here)

I have attached a sample where We display one of the Columns Values for all the rows in the ListBox, when clicking
on a button.

ParsingThroughRows.zip



The following code is used inside the ButtonClick event to acheive the behavior.

foreach (Record rd in this.GridGroupingControl1.Table.Records)
{
string someVal=rd.GetValue("SomeColumnName").ToString();
//here you can use this value for calculations according to your needs.
}

Let me know if this helps.

Thanks,
A.Sivakumar


SA Sandeep September 11, 2006 09:47 AM UTC

Hi Sivakumar,
Thanks for your updates. I think I am not able to explain you the exact problem.
My problem is that I am not using the dataset exactly how you has used in the EditAllRows Sample. Let say I want to create the same application like EditAllRows. But here I am going to set datasource at runtime and fetch the data in datatable and then assign that table to GGC. And while saving the data I am getting TopLevelTable as null (this is the actual problem which dont occur in your application but it occurs in my application). If you will update the EditAllRows application with runtime table attached as a datasource and also save properly after clicking save button of bar, then my problem will be solved (Please provide me this type of code).
Thanks,
Sandeep


SI Sivakumar Syncfusion Team September 11, 2006 09:15 PM UTC

Hi Sandeep,

Thanks, for the description. I will try modifying the EditAllRows sample as you mentioned and will update you with more info and/sample some solution as soon as possible.

Thanks,
A.Sivakumar.



SA Sandeep September 12, 2006 05:09 AM UTC

Thanks Sivakumar,
I am waiting for your reply.

Sandeep


SI Sivakumar Syncfusion Team September 12, 2006 05:56 PM UTC

Hi Sandeep,

I think, the above issue might be related to ''Initializing the grid'' in page''s Init, that we are discussing with you in the following forum

Forum reg Initializing the grid


if you still get issues after following the above steps, I will work on the sample and will update you.


Best Regards,
A.Sivakumar


SA Sandeep September 13, 2006 11:24 AM UTC

Hi Sivakumar,
Thank you very much for your update. My problem was solved by binding and assigning primary key to grid.

Thanks again,
Sandeep

Loader.
Live Chat Icon For mobile
Up arrow icon