T
ton
Hi,
I've created a custom server control dbList which contains a datagrid
In my CreateChildControls sub I add the control
Controls.Add(Grid)
In my Fill sub I have this code (Fill can be executed from a button on the
page like dbList.Fill)
sqlConn.ConnectionString = "workstation id=VRS7;packet size=4096;user
id=Sa;data source=VRSSERVER;persist security info=False;initial
catalog=Sales"
sqlAdap = New SqlClient.SqlDataAdapter("select top 50 * from tuning",
sqlConn.ConnectionString) '' ConnectionString
sqlAdap.Fill(DS, "Tuning")
grid.DataSource = DS
grid.Visible = True
grid.BorderStyle = BorderStyle.Solid
grid.DataBind()
CreateChildControls()
After pressing the buttons nothing happens.
I use:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.ComponentModel
Imports System.Web.SessionState
Imports System.Data
Imports System.Data.SqlClient
and my declaration is:
Dim grid As New DataGrid
Dim sqlConn As New SqlClient.SqlConnection
Dim sqlAdap As SqlClient.SqlDataAdapter
Dim DS As New DataSet
When I add a grid to my page and I use the same code as in de fill command,
the datagrid will be visible.
What is wrong ??
Ton
I've created a custom server control dbList which contains a datagrid
In my CreateChildControls sub I add the control
Controls.Add(Grid)
In my Fill sub I have this code (Fill can be executed from a button on the
page like dbList.Fill)
sqlConn.ConnectionString = "workstation id=VRS7;packet size=4096;user
id=Sa;data source=VRSSERVER;persist security info=False;initial
catalog=Sales"
sqlAdap = New SqlClient.SqlDataAdapter("select top 50 * from tuning",
sqlConn.ConnectionString) '' ConnectionString
sqlAdap.Fill(DS, "Tuning")
grid.DataSource = DS
grid.Visible = True
grid.BorderStyle = BorderStyle.Solid
grid.DataBind()
CreateChildControls()
After pressing the buttons nothing happens.
I use:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.ComponentModel
Imports System.Web.SessionState
Imports System.Data
Imports System.Data.SqlClient
and my declaration is:
Dim grid As New DataGrid
Dim sqlConn As New SqlClient.SqlConnection
Dim sqlAdap As SqlClient.SqlDataAdapter
Dim DS As New DataSet
When I add a grid to my page and I use the same code as in de fill command,
the datagrid will be visible.
What is wrong ??
Ton