strange behaviour in gridview servercontrol with allowpaging = true

T

ton

Hi,
This is a part of my custum server control. The DataTbl in de sub is a
recordset (ADODOTNET). It works fine when Allowpaging is not set, but when I
set is to True I receive an error: Nullreference exception was unhandled by
user code

Protected Overrides Sub CreateChildControls()
Grid = New GridView
Grid.ID = "Grid"
Grid.AutoGenerateColumns = True
Grid.AllowPaging = True
Grid.DataSource =DataTbl 'a correct datatable
Grid.DataBind() 'ERROR OCCURS on this line: Nullreference exception
was unhandled by user code
Controls.Add(Grid)
End Sub

thanks


ton
 
P

Peter Bucher [MVP]

Hello Ton
This is a part of my custum server control. The DataTbl in de sub is a
recordset (ADODOTNET). It works fine when Allowpaging is not set, but when
I set is to True I receive an error: Nullreference exception was unhandled
by user code
If you allow Paging, you`ve to handle the pageindexchanged event.
It could be that problem, try to wire up the event manually and restart.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top