This is a migrated thread and some comments may be shown as answers.

Assigning an ID to a grid row

3 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 30 Jan 2008, 09:20 AM
Hi,

In the previous version of RadGrid, I was able to assign an ID to each row of the grid using the syntax e.Item.ID where e is a GridDataItem in the ItemDataBound event of the RadGrid.

Now when I do this I notice that each row is automatically assigned a numeric ID and my ID is overwritten.  I can see that the HTML produced by the grid has been reduced in size and this is one way you have done this.  However, I still need to add my own identifier to the row so that when it is selected I know what has been selected - a number is not sufficient for me in this case.

I attempted to add a custom 'rowid' attribute to the row in the ItemDataBound event, which is successfully rendered on the table rows....but then I cant seem to access this in the client side code.

Can you offer any suggestions on how to solve this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 30 Jan 2008, 02:28 PM
I hadnt noticed this before, so if this is of any help, I have the following ClientEvents set:

<ClientSettings  ApplyStylesOnClient="true">  
    <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
    <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" /> 
    <ClientEvents OnRowSelected="GridRowSelected" OnRowDeselected="GridRowDeselected" OnTableCreated="Resize" OnMasterTableViewCreated="Resize" /> 
    <Resizing EnableRealTimeResize="true" /> 
</ClientSettings> 
 

and in the JavaScript function for OnRowSelected, the 'eventArgs' parameter is always passed through as undefined.  Therefore, I have no way of accessing anything other than the sender which is the grid itself; I cant access anything to do with the selected row.

Thanks.
0
Jonathan
Top achievements
Rank 1
answered on 30 Jan 2008, 04:21 PM
I have managed to sort this out now.  It appears to be my misunderstanding of what has changed between the two versions.

Apologies for wasting anybody's time!
0
License Developer
Top achievements
Rank 1
answered on 30 Jan 2008, 10:09 PM
what is the answer?
Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
License Developer
Top achievements
Rank 1
Share this question
or