[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

GridView SelectedDataKey Error

Posted on 2007-11-28
2
Medium Priority
?
915 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
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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

872 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