I am trying to get a basic grid working using a linqDataSource which is populated with a stored procedure.
The problem I have is that on page load I get an 'object reference not set to an instance error', which I believe it is refering to the grid. I can get the grid to work not using linqDataSource by binding the data to the grid on page load, but i need to get it working using a linqDataSource.
Any help would be much appreciated.
| <div style="width:100%;overflow:auto;"> |
| <telerik:RadGrid ID="RadGrid1" Width="3000px" AllowPaging="True" PageSize="15" runat="server" AllowSorting="true" |
| GridLines="None" DataSourceID="linq_mySP"> |
| <MasterTableView Width="100%" /> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <FilterMenu EnableTheming="True"> |
| <CollapseAnimation Duration="200" Type="OutQuint" /> |
| </FilterMenu> |
| </telerik:RadGrid> |
| </div> |
| <asp:LinqDataSource AutoPage="True" ID="linq_mySP" runat="server"></asp:LinqDataSource> |
| Imports System.Data |
| Imports Telerik.Web.UI |
| Partial Class gridPages_telerikGrid |
| Inherits System.Web.UI.Page |
| Protected Sub linq_mySP_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles linq_mySP.Selecting |
| Using context As New DataClassesDataContext |
| Dim fromdate As DateTime = DateAdd(DateInterval.Year, -5, DateTime.Now) |
| Dim todate As DateTime = DateTime.Now |
| e.Result = context.spTest(49, fromdate, todate) |
| End Using |
| End Sub |
| End Class |
The problem I have is that on page load I get an 'object reference not set to an instance error', which I believe it is refering to the grid. I can get the grid to work not using linqDataSource by binding the data to the grid on page load, but i need to get it working using a linqDataSource.
Any help would be much appreciated.