I am trying to output simply DataGrid of a coutry listing on a web form via
a business object and XML web service...I receive no errors but no table
HTML either. (I know the service and business object is producing data
because it works in a Windows form application).
Here is my WebForm:
----------------------------------------
<%@ Register TagPrefix="allL evels" TagName="mainHe ader"
Src="mainHeader .ascx" %>
<%@ Register TagPrefix="allL evels" TagName="second Header"
Src="secondHead er.ascx" %>
<%@ Page Language="vb" AutoEventWireup ="false" Codebehind="ind ex.aspx.vb"
Inherits="LisEx plorerV1.index1 "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
....stuff
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<allLevels:main Header runat="server" id="mainHeader " />
<allLevels:seco ndHeader runat="server" id="secondHeade r" />
<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 208px; POSITION:
absolute; TOP: 224px" runat="server" DataSource="<%# CountryData %>"
DataMember="Org Cntry">
</asp:DataGrid>
</body>
</HTML>
Here is my WebForm's CodeBehind File
-----------------------------------
Public Class index1
Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.CountryData = New
LisExplorerV1.L ISXMLWebService Reference.count ries1
CType(Me.Countr yData,
System.Componen tModel.ISupport Initialize).Beg inInit()
'
'CountryData
'
Me.CountryData. DataSetName = "countries1 "
Me.CountryData. Locale = New
System.Globaliz ation.CultureIn fo("en-US")
CType(Me.Countr yData,
System.Componen tModel.ISupport Initialize).End Init()
End Sub
Protected WithEvents CountryData As
LisExplorerV1.L ISXMLWebService Reference.count ries1
Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
End Class
Here is my .asmx.vb file:
------------------------------------
Imports System.Web.Serv ices
<System.Web.Ser vices.WebServic e( _
Namespace:="htt p://LISExplorer/XMLWebServices" , _
Description:="A set of Web Services for the LIS Explorer v1.0")> _
Public Class XMLWebServices
Inherits System.Web.Serv ices.WebService
Friend WithEvents SqlSelectComman d1 As System.Data.Sql Client.SqlComma nd
Friend WithEvents SqlInsertComman d1 As System.Data.Sql Client.SqlComma nd
Friend WithEvents SqlConnection1 As System.Data.Sql Client.SqlConne ction
Friend WithEvents SqlDataAdapter1 As
System.Data.Sql Client.SqlDataA dapter
<WebMethod()> Public Function GetCountries() As Countries1
Dim countries As New countries1
SqlDataAdapter1 .Fill(countries )
Return countries
End Function
#Region " Web Services Designer Generated Code "
Public Sub New()
MyBase.New()
'This call is required by the Web Services Designer.
InitializeCompo nent()
'Add your own initialization code after the InitializeCompo nent()
call
End Sub
'Required by the Web Services Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
Friend WithEvents Countries1 As LISExplorerV1WS .countries1
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.SqlSelectCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlConnectio n1 = New System.Data.Sql Client.SqlConne ction
Me.SqlInsertCom mand1 = New System.Data.Sql Client.SqlComma nd
Me.SqlDataAdapt er1 = New System.Data.Sql Client.SqlDataA dapter
Me.Countries1 = New LISExplorerV1WS .countries1
CType(Me.Countr ies1,
System.Componen tModel.ISupport Initialize).Beg inInit()
'
'SqlSelectComma nd1
'
Me.SqlSelectCom mand1.CommandTe xt = "SELECT CountryIdx, CountryCode,
CountryName FROM OrgCntry"
Me.SqlSelectCom mand1.Connectio n = Me.SqlConnectio n1
'
'SqlConnection1
'
Me.SqlConnectio n1.ConnectionSt ring = "workstatio n
id=""CIL-094"";packet size=4096;integ rated security=SSPI;d ata source=""c" &
_
"il-094"";persist security info=False;init ial catalog=sacdb"
'
'SqlInsertComma nd1
'
Me.SqlInsertCom mand1.CommandTe xt = "INSERT INTO OrgCntry(Countr yIdx,
CountryCode, CountryName) VALUES (@CountryIdx, @" & _
"CountryCod e, @CountryName); SELECT CountryIdx, CountryCode,
CountryName FROM Org" & _
"Cntry"
Me.SqlInsertCom mand1.Connectio n = Me.SqlConnectio n1
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@CountryI dx",
System.Data.Sql DbType.SmallInt , 2, "CountryIdx "))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@CountryC ode",
System.Data.Sql DbType.NVarChar , 2, "CountryCod e"))
Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@CountryN ame",
System.Data.Sql DbType.NVarChar , 40, "CountryNam e"))
'
'SqlDataAdapter 1
'
Me.SqlDataAdapt er1.InsertComma nd = Me.SqlInsertCom mand1
Me.SqlDataAdapt er1.SelectComma nd = Me.SqlSelectCom mand1
Me.SqlDataAdapt er1.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "OrgCntry", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("Country Idx", "CountryIdx "), New
System.Data.Com mon.DataColumnM apping("Country Code", "CountryCod e"), New
System.Data.Com mon.DataColumnM apping("Country Name", "CountryName")} )})
'
'Countries1
'
Me.Countries1.D ataSetName = "countries"
Me.Countries1.L ocale = New System.Globaliz ation.CultureIn fo("en-US")
CType(Me.Countr ies1,
System.Componen tModel.ISupport Initialize).End Init()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
#End Region
End Class