?
Solved

GridView SelectedDataKey Error

Posted on 2007-11-28
2
Medium Priority
?
894 Views
Last Modified: 2013-11-07
I have used this on tons of gridviews

Session("ScheduleID") = CaseEventsGridView.SelectedDataKey.Value

This time I am getting an error
System.NullReferenceException: Object reference not set to an instance of an object.
I cannot understand why it is null?  THere is data in the grid and I can see the ID.

Please help!!
0
Comment
Question by:vzorn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
RedKelvin earned 2000 total points
ID: 20371146
This will happen if the dataKeyNames are not set, or no row is selected
0
 

Author Comment

by:vzorn
ID: 20375088
I see.  I was using the RowCommand event and I needed to get the row first.

Thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question