I keep getting this error, sometimes everytime I run the gridview, sometimes it won't throw the error and it will show the results. Here is my code.
Dim DS_Assets As DataSet |
sqlQuery = "SELECT location.location_id, location.site_id, location.description, location.code, location.site_id, " & _ |
"asset.asset_tag, asset.serial_number, asset.item_id, asset.date_updated, " & _ |
"item.description " & _ |
"FROM location INNER JOIN asset ON location.location_id = asset.location_id INNER JOIN item ON asset.item_id = item.item_id " & _ |
"WHERE location.site_id=" & Site |
DS_Assets = common.DBConnect(sqlQuery, "assets", activeDBServer, activeDBName, activeDBUser, activeDBPass) ' This is the function that returns the Dataset |
Me.RadGridView1.MasterGridViewTemplate.Columns.Clear() |
Me.RadGridView1.MasterGridViewTemplate.GroupByExpressions.Clear() |
Me.RadGridView1.MasterGridViewTemplate.SortExpressions.Clear() |
Me.RadGridView1.MasterGridViewTemplate.AllowAddNewRow = False |
Me.RadGridView1.MasterGridViewTemplate.AutoGenerateColumns = False |
Me.RadGridView1.MasterGridViewTemplate.EnableGrouping = False |
Me.RadGridView1.DataSource = DS_Assets.Tables(0) |
The error is thrown on the last line when I try to bind the data to the gridview. There are about 3300 rows in the data being returned. If I look at the inner exception it is returning "NullReferenceException: Object reference not set to an instance of an object."
But the data is there, the Dataset is correct. I have run this code on a regular GridView control and it works fine. Just won't work on the RadGridView. Any ideas what I am doing wrong?