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

ASP.NET MVC GRID ROWINDEX

Hello Syncfusion Team,

How can I get the RowIndex when I add row dynamically or while binding it to DataSource?

I want S.NO to be populated automatically when Add Button is pressed in the toolbar.

Can anybody please suggest?

TIA
Manoj

1 Reply

KK Karthick Kuppusamy Syncfusion Team August 25, 2016 03:29 AM UTC

Hi Manoj,  
  
Query 1: How can I get the RowIndex when I add row dynamically or while binding it to DataSource?  
  
Before proceed with your requirement, we need to know the data source that you have bound to the grid because based on the dataSource the newly added row index value is changed.  
  
Local Data:  
   
                If you bind “local data” as a grid data source then the dynamically added row is always added at the Zeroth index of the grid.   
  
Remote Data:  
   
1.       Set IsIdentity:  
If you bind “remote data” as a grid data source and set “IsIdentity” property of “Columns” as true then the newly added record is added at last row of last page because if IsIdentity is true then the primary key value is auto incremented hence it always added at the last row of the last page.  
2.       Enable Sorting for Primary key column:  
If you bind “remote data” as a grid data source and enable initial sorting for primary key column then the newly added record row index is based on the primary key value. If the newly added record value is within the currentview page then we can find the row index of the newly added record or else we need to find the index of the newly added row from the server. So can you please share the details about the dataSource that you have bound to the grid as of now we can get the rowindex of newly added record by using the following way.  
  
Query 2: I want S.NO to be populated automatically when Add Button is pressed in the toolbar.  
  
Could you please share the following information which will help us to provide the prompt solution:                                                                                  
  1. Datatype of your DataSource (Local or Remote).
2.       Are using any adaptor in Grid? If so, tell me the adaptor type.   
3.       Share your first array object of your DataSource.    
4.       Grid rendering code example.  
  
Regards,  
 K.Karthick.  


Loader.
Live Chat Icon For mobile
Up arrow icon