I have created grid dynamically and wanted to bind it.
I wanted to place grid in tabpanel.
I made following code for this purpose:
Protected Sub TabContainer1_ActiveTabChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles TabContainer1.ActiveTabChanged
Dim actTab As String = TabContainer1.ActiveTab.ID.ToString()
Dim gv As GridView
ds = gc.GetDataToListBinder("select * from ParameterOnline where TabName='Courts'")
If actTab = "Panel_Courts" Then
gv.DataSource = ds.Tables(0)
TabContainer1.ActiveTab.Controls.Add(gv)
End If
End Sub
But its giving me error:
object not set to an instance of an object
By debugging i seen the dataset ds, but it is having all the necessary values in it.
I am not understanding where i am making mistake?
Answer in c# will also help me.
EDIT:
On gv.DataSource = ds.Tables(0)
line i am getting error.