By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,215 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,215 IT Pros & Developers. It's quick & easy.

no display of DataGrid table in WebForm

P: n/a
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="allLevels" TagName="mainHeader"
Src="mainHeader.ascx" %>
<%@ Register TagPrefix="allLevels" TagName="secondHeader"
Src="secondHeader.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb"
Inherits="LisExplorerV1.index1"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
....stuff
</HEAD>
<body MS_POSITIONING="GridLayout">

<allLevels:mainHeader runat="server" id="mainHeader" />
<allLevels:secondHeader runat="server" id="secondHeader" />

<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 208px; POSITION:
absolute; TOP: 224px" runat="server" DataSource="<%# CountryData %>"
DataMember="OrgCntry">
</asp:DataGrid>
</body>
</HTML>

Here is my WebForm's CodeBehind File
-----------------------------------

Public Class index1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.CountryData = New
LisExplorerV1.LISXMLWebServiceReference.countries1
CType(Me.CountryData,
System.ComponentModel.ISupportInitialize).BeginIni t()
'
'CountryData
'
Me.CountryData.DataSetName = "countries1"
Me.CountryData.Locale = New
System.Globalization.CultureInfo("en-US")
CType(Me.CountryData,
System.ComponentModel.ISupportInitialize).EndInit( )

End Sub
Protected WithEvents CountryData As
LisExplorerV1.LISXMLWebServiceReference.countries1
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

End Class


Here is my .asmx.vb file:
------------------------------------

Imports System.Web.Services

<System.Web.Services.WebService( _
Namespace:="http://LISExplorer/XMLWebServices", _
Description:="A set of Web Services for the LIS Explorer v1.0")> _
Public Class XMLWebServices
Inherits System.Web.Services.WebService
Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Friend WithEvents SqlDataAdapter1 As
System.Data.SqlClient.SqlDataAdapter

<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.
InitializeComponent()

'Add your own initialization code after the InitializeComponent()
call

End Sub

'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer

'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.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.Countries1 = New LISExplorerV1WS.countries1
CType(Me.Countries1,
System.ComponentModel.ISupportInitialize).BeginIni t()
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT CountryIdx, CountryCode,
CountryName FROM OrgCntry"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "workstation
id=""CIL-094"";packet size=4096;integrated security=SSPI;data source=""c" &
_
"il-094"";persist security info=False;initial catalog=sacdb"
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO OrgCntry(CountryIdx,
CountryCode, CountryName) VALUES (@CountryIdx, @" & _
"CountryCode, @CountryName); SELECT CountryIdx, CountryCode,
CountryName FROM Org" & _
"Cntry"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CountryIdx",
System.Data.SqlDbType.SmallInt, 2, "CountryIdx"))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CountryCode",
System.Data.SqlDbType.NVarChar, 2, "CountryCode"))
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.SqlParameter("@CountryName",
System.Data.SqlDbType.NVarChar, 40, "CountryName"))
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New
System.Data.Common.DataTableMapping() {New
System.Data.Common.DataTableMapping("Table", "OrgCntry", New
System.Data.Common.DataColumnMapping() {New
System.Data.Common.DataColumnMapping("CountryIdx", "CountryIdx"), New
System.Data.Common.DataColumnMapping("CountryCode" , "CountryCode"), New
System.Data.Common.DataColumnMapping("CountryName" , "CountryName")})})
'
'Countries1
'
Me.Countries1.DataSetName = "countries"
Me.Countries1.Locale = New System.Globalization.CultureInfo("en-US")
CType(Me.Countries1,
System.ComponentModel.ISupportInitialize).EndInit( )

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.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

#End Region

End Class
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.