So, here's my code (it is housed in a button_click event
If grdBidDescriptions.Behaviors.Selection.SelectedRows.Count > 0 Then
Dim qqPhaseID As Integer
qqPhaseID = grdBidDescriptions.Behaviors.Selection.SelectedRows.Item(0).DataKey.ToString
Response.Redirect("SavedPhaseDescriptions.aspx?QQPhaseID=" & qqPhaseID)
End If
The error is attached as an image.
The funny thing is, I have the exact code in another window with a grid that works perfectly and I have looked for any differences and can't find any between the two grids. Please give me a hint of what I am doing wrong here.
Hello vbhandyman ,
EnableDataViewState when set to true generally keeps the data source of the grid in the ViewState. The selected row should be kept in the view state regardless of that property.
Was your grid inside an update panel or some other ajax enabled control? If that was the case then it is necessary to disable the grid’s ajax.
Let me know if you have any questions or if you happen to need further assistance.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
I found a way around it... I need to disable AJAX View State as well as AJAX and use the EnableDataViewState.
Thank you for posting in our forum.
I see you’re getting the selected row in a button click event. Could you handle the grid’s row selection changed and see whether it’s fired before the button click event ?
If it has, then there shouldn’t be a problem getting the selected row at that point in the page life cycle. Otherwise if the button click if fired before the selection changed event the selected row will not have been changed and such an error would be expected to be raised.
It would be helpful also if you could let me know which version of our controls you’re using and if you could provide the mark-up you have for the page so that I may look further into this.
I’m looking forward to your reply.