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"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<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 %>"

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
Me.CountryData = New
System.ComponentModel.ISupportInitialize).BeginIni t()
Me.CountryData.DataSetName = "countries1"
Me.CountryData.Locale = New
System.ComponentModel.ISupportInitialize).EndInit( )

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

'NOTE: The following placeholder declaration is required by the Web Form
'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.
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

<WebMethod()> Public Function GetCountries() As Countries1
Dim countries As New countries1
Return countries
End Function

#Region " Web Services Designer Generated Code "

Public Sub New()

'This call is required by the Web Services Designer.

'Add your own initialization code after the InitializeComponent()

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
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
System.ComponentModel.ISupportInitialize).BeginIni t()
Me.SqlSelectCommand1.CommandText = "SELECT CountryIdx, CountryCode,
CountryName FROM OrgCntry"
Me.SqlSelectCommand1.Connection = Me.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"
Me.SqlInsertCommand1.CommandText = "INSERT INTO OrgCntry(CountryIdx,
CountryCode, CountryName) VALUES (@CountryIdx, @" & _
"CountryCode, @CountryName); SELECT CountryIdx, CountryCode,
CountryName FROM Org" & _
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
System.Data.SqlDbType.SmallInt, 2, "CountryIdx"))
System.Data.SqlDbType.NVarChar, 2, "CountryCode"))
System.Data.SqlDbType.NVarChar, 40, "CountryName"))
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
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")})})
Me.Countries1.DataSetName = "countries"
Me.Countries1.Locale = New System.Globalization.CultureInfo("en-US")
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
End If
End If
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.