S
Sumana
Below is the code, for the datagrid custom control. When i view this
in a aspx page, the text "Hello" shows up but not the datagrid. Anyone
can tell me why?
thanks
sumana
Imports System.ComponentModel
Imports System.Web.UI
Imports System
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Web.SessionState
Imports System.Data
Imports System.Data.SqlClient
<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class
WebCustomControl1
Inherits System.Web.UI.WebControls.DataGrid
Dim _text As String
Dim grid As New DataGrid()
Dim cn As New SqlClient.SqlConnection("Initial Catalog=LFBP01;Data
Source=brkdbdn61\brksql01;User Id=YYYD368S;Password=YYYD368S")
Dim da As New SqlClient.SqlDataAdapter("select buyer_cd,buyer_nme
from lftp100_buyer", cn)
Dim DS As New DataSet()
<Bindable(True), Category("Appearance"), DefaultValue("")>
Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
output.Write([Text])
da.Fill(DS)
grid.DataSource = DS
grid.DataBind()
grid.Visible = True
grid.BorderStyle = BorderStyle.Solid
End Sub
End Class
in a aspx page, the text "Hello" shows up but not the datagrid. Anyone
can tell me why?
thanks
sumana
Imports System.ComponentModel
Imports System.Web.UI
Imports System
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Web.SessionState
Imports System.Data
Imports System.Data.SqlClient
<DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")> Public Class
WebCustomControl1
Inherits System.Web.UI.WebControls.DataGrid
Dim _text As String
Dim grid As New DataGrid()
Dim cn As New SqlClient.SqlConnection("Initial Catalog=LFBP01;Data
Source=brkdbdn61\brksql01;User Id=YYYD368S;Password=YYYD368S")
Dim da As New SqlClient.SqlDataAdapter("select buyer_cd,buyer_nme
from lftp100_buyer", cn)
Dim DS As New DataSet()
<Bindable(True), Category("Appearance"), DefaultValue("")>
Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
output.Write([Text])
da.Fill(DS)
grid.DataSource = DS
grid.DataBind()
grid.Visible = True
grid.BorderStyle = BorderStyle.Solid
End Sub
End Class