remove the data source from aspx and you can create data source from code behind and bind to gridview on button click event like below
click event code:
Dim SqlDataSource1 As New SqlDataSource()
SqlDataSource1.ID = "SqlDataSource1"
Me.Page.Controls.Add(SqlDataSource1)
SqlDataSource1.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("reg").ConnectionString
SqlDataSource1.SelectCommand = "SELECT * FROM [table]"
GridView1.DataSource = SqlDataSource1
GridView1.DataBind()