cancel
Showing results for 
Search instead for 
Did you mean: 

cannot see data in SAP.Web.UI.Controls.Table

Former Member
0 Kudos

Hi,I have created a portal project and dragged a sap table into the design area. then i call a webservice and bind the resulting dataset to the table. the dataset seems to bind, since i can see there are the right number of pages in the table, but i cannot see any of the data. all the rows are blank. am i treating the ascx file correctly? i deploy and browse to test it.

this is the code in the aspx:

-


<%@ Register TagPrefix="sap" Namespace="SAP.Web.UI.Controls" Assembly="SAP.Web, Version=1.2.0.0, Culture=neutral, PublicKeyToken=50436dca5c7f7d23" %>

<%@ Control language="vb" Codebehind="PortalComponent1.ascx.vb" AutoEventWireup="false" Inherits="pdkdemo2.PortalComponent1" targetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<!%@ PortalComponent name="PortalComponent1" %>

<LINK href="C:\Program Files\SAP\SAP Portal Development Kit for .NET 1.0\Controls\ur\ur_design.css"

type="text/css" rel="stylesheet">

<body class="prtlBody">

<sap:Table id="Table1" runat="server">

<sap:Caption Text="Table" ID="Caption2"></sap:Caption>

<sap:TableRow ID="Table1_ItemTemplate">

<sap:TableCell ID="TableCell4" Title="Column1">

<sap:TextView ID="TextView4"></sap:TextView>

</sap:TableCell>

<sap:TableCell ID="TableCell5" Title="Column2">

<sap:TextView ID="TextView5"></sap:TextView>

</sap:TableCell>

<sap:TableCell ID="TableCell6" Title="Column3">

<sap:TextView ID="TextView6"></sap:TextView>

</sap:TableCell>

</sap:TableRow>

</sap:Table>

</body>

-


and this is the code behind:

Imports System

Imports System.Collections

Imports System.ComponentModel

Imports System.Data

Imports System.Drawing

Imports System.Web

Imports System.Web.UI

Imports SAP.Portal.Web.UI

Imports SAP.UI

Imports SAP.Web.UI.Controls

Public class PortalComponent1

Inherits SAP.Portal.Web.UI.PortalComponent

Protected WithEvents Table1 As SAP.Web.UI.Controls.Table

Protected WithEvents Caption1 As SAP.Web.UI.Controls.Caption

Protected WithEvents Table1_ItemTemplate As SAP.Web.UI.Controls.TableRow

Protected WithEvents TableCell1 As SAP.Web.UI.Controls.TableCell

Protected WithEvents TextView1 As SAP.Web.UI.Controls.TextView

Protected WithEvents TableCell2 As SAP.Web.UI.Controls.TableCell

Protected WithEvents TextView2 As SAP.Web.UI.Controls.TextView

Protected WithEvents TableCell3 As SAP.Web.UI.Controls.TableCell

Protected WithEvents Caption2 As SAP.Web.UI.Controls.Caption

Protected WithEvents TableCell4 As SAP.Web.UI.Controls.TableCell

Protected WithEvents TextView4 As SAP.Web.UI.Controls.TextView

Protected WithEvents TableCell5 As SAP.Web.UI.Controls.TableCell

Protected WithEvents TextView5 As SAP.Web.UI.Controls.TextView

Protected WithEvents TableCell6 As SAP.Web.UI.Controls.TableCell

Protected WithEvents TextView6 As SAP.Web.UI.Controls.TextView

Protected WithEvents TextView3 As SAP.Web.UI.Controls.TextView

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim proxy As New secblrnd.Service1

Dim ds As DataSet

ds = proxy.GetData("U020_EQUIP", "ALL", "NO", 0, "MOODLET1", "MOODLET1")

Table1.DataSource = ds

Table1.DataBind()

End Sub

#Region "Web Form Designer generated code"

Protected Overrides Sub OnInit(ByVal e As EventArgs)

'

' CODEGEN: This call is required by the ASP.NET Web Form Designer.

'

InitializeComponent()

MyBase.OnInit(e)

End Sub

' Required method for Designer support - do not modify

' the contents of this method with the code editor.

Private Sub InitializeComponent()

End Sub

#End Region

End class

-


any assistance would be highly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

The problem is that the SAP table doesn't support this kind of "dynamic binding" at the moment. The SAP table can contain any one of several controls in each cell, and these controls have several possible properties to bind to. So currently you have to "tell" the table what you want to bind to.

You have several options:

1. The easiest option, if you can create a typed dataset in design-time, according to what your webservice returns, then do that... and then put an instance of it on your portal component, and bind your table to that typed dataset (using the designer property grid). This should create a default ItemTemplate with all textViews in the cells, and the texts will be bound to the columns.

2. Write code in ItemCreated Event handler of the table. This event will be raised for each row in the DS. There you can tell the cells to get the data from the content. Remember that you'd have to create the cells according to the number of columns and set the content of each cell to be what control you want (like TextView) and then fill the properties of that control.

3. If you know the Data structure, but don't want to or can't create a typed DataSet - First define the columns using the designer (right click the table, select "edit columns"). Then in the event handler (from "2") just set the property "text" of each TextView which is in the content of each cell (use the Cell's property "TableCellContent" to get to the TextView control)

4. Don't use databinding and create the table contents completely manually (See here -

)

One last thing, here's a link to some more explanations about DataBinding in SAP controls:

https://media.sdn.sap.com/html/submitted_docs/PDK_for_dotNET_10/Programming%20with%20PDK%20for%20.NE...

If you choose a solution and need more help, just ask.

Regards,

Ofer