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

Command Cell throws "Expecting 1 value(s) for the key being indexed, but received 0 value(s)."}

5 Answers 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ankur Khator
Top achievements
Rank 1
Ankur Khator asked on 04 Aug 2009, 02:12 PM
Hi,
I have a GridViewCommandColumn in my grid. I populate the grid, sort on the command column. Then in some operation I update the values of the GridViewCommandColumn. Upon clicking any cell of this column, I get the following exception

Message : {"Expecting 1 value(s) for the key being indexed, but received 0 value(s)."}
Stack :    at System.Data.Index.FindNodeByKeys(Object[] originalKey)
   at System.Data.Index.FindRecordByKey(Object[] key)
   at System.Data.DataView.FindByKey(Object[] key)
   at System.Data.DataView.Find(Object[] key)
   at Telerik.WinControls.Data.DataAccessComponent.FindRow(GridViewRowInfo rowInfo)
   at Telerik.WinControls.UI.GridViewInfo.GetVisibleRowIndex(GridViewRowInfo rowInfo)
   at Telerik.WinControls.UI.GridCellElement.get_RowIndex()
   at Telerik.WinControls.UI.GridViewCellEventArgs..ctor(GridCellElement GridViewCell)
   at Telerik.WinControls.UI.GridCommandCellElement.OnClick(EventArgs e)
   at Telerik.WinControls.UI.GridCommandCellElement.button_Click(Object sender, EventArgs e)
   at Telerik.WinControls.RadItem.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
   at Telerik.WinControls.RadItem.DoClick(EventArgs e)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadElement.CallDoMouseUp(MouseEventArgs e)
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.UI.RadGridView.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at Microsoft.AdCenter.CommunityPlatform.UI.Desktop.Program.Main() in c:\Enlistments\CommunityPlatform\Dev\private\src\UI\Desktop\Program.cs:line 19


Please suggest what can be wrong here.

Thanks
Ankur

5 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 04 Aug 2009, 02:41 PM
Hi Ankur Khator,

I am not able to locate the issue by looking at this exception. Also, I could not reproduce the issue with tests. Generally, it is not expected to sort the command column. Please, could you describe your scenario in detail and send us your application. This will help me locating the issue. I am looking forward to your reply.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ankur Khator
Top achievements
Rank 1
answered on 06 Aug 2009, 06:21 AM
Hi,
I was able to avoid this problem by explicitly setting DataSource and MasterGridViewTemplate.DataSource properites of the grid to null before binding it to different dataset.

Ankur



0
Jack
Telerik team
answered on 06 Aug 2009, 12:37 PM
Hi Ankur Khator,

I am glad to hear that you have found a solution to this issue. However, we still don't know what causes it. Could you please send us your application so we can review it and address any potential issue. I am looking forward to your reply.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ankur Khator
Top achievements
Rank 1
answered on 10 Aug 2009, 12:52 PM
Hi Jack,
since this is a part of my bigger application, it is very hard for me to isolate this problem and send over application to you. Also since we got the workaround, it is difficult for me to committ time on this. I hope you understand.
I will surely isolate this out if I observe this again.

Thanks for your help
Ankur
0
Jack
Telerik team
answered on 11 Aug 2009, 11:16 AM
Hi Ankur Khator,

I understand. We will try to simulate the issue locally. If you have any other questions, please write back.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Ankur Khator
Top achievements
Rank 1
Answers by
Jack
Telerik team
Ankur Khator
Top achievements
Rank 1
Share this question
or