Hello all
I have 3 pages in my application
all 3 pages have gridview with same id, i want to bind data from 3 different tables to each 3 gridviews.
i want to create universal databind procedure to bind data to gridview in a class
i am using this line of code in my class
i am passing sql string in page1 pageloadVB Code:
Public sub bind(byval sql as string) sda = New SqlDataAdapter(sql, strConn) sda.Fill(ds, "mytable") GridView1.DataSource = ds.Tables("mytable").DefaultView GridView1.DataBind() end sub
i am calling this class procedure in page load of page1 by creating object instance of the class
But it is giving an errorVB Code:
obj.bind(Select * from CustomerDetails)
object reference not set to an instance of object
how can i take referene of the gridview control present in page1 to the class
Kindly help me to solve this
Thanks in advance




Reply With Quote