cancel
Showing results for 
Search instead for 
Did you mean: 

Using Table Control in .NET iView

Former Member
0 Kudos

Hi,

I am working on .NET iview.

i am retrieving values from database and assigning them to LinkToURL control's text property and making them into hyper link.

I am doing this in my code.

I am displaying the links by directly adding LinkToURL to the Controls collection.

Eg.

LinkToURL lnk = new LinkToURL();

lnk.Text = sName;

I want to use a SAP Table control to display these links.

Can anyone tell me how to do it.

Here is my present code :

LinkToURL lnk = new LinkToURL();

lnk.Text = sName;

lnk.Reference = sUrl;

lnk.Size=SAP.UI.LinkSize.SMALL;

lnk.Type=SAP.UI.LinkType.REPORTING;

lnk.ScriptingEvents.Add("LINKCLICK", "doSendEvent('" + sUrl + "','" + sName + "');return false;");

this.Controls.Add(new System.Web.UI.LiteralControl("<LI TYPE='square' size='-10'>"));

this.Controls.Add(lnk);

this.Controls.Add(new System.Web.UI.LiteralControl("</LI>"));

Regards

Saurabh saxena

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Saurabh,

you have 3 ways of doing that:

1. Using the Collection Editor:

right-click on the table control it and choose Edit Columns. In the TableCell Collection Editor that opens, choose an item, and change its TableCellContent property to any of the available options. Expand the TableCellContent node, click DataBindings, and bind the Key and Text properties to data sources.

2. In the .ascx file of a portal component:

In HTML view, use a different item instead of a TextView item for the TableCell element.

For example, instead of:

<sap:TableRow ID="Table3_ItemTemplate">

<sap:TableCell ID="Table3_au_id" Title="au_id">

<sap:TextView ID="textView1" Text='<%# DataBinder.Eval(Container.Parent, "DataSourceRow.DataItem.au_id") %>'>

</sap:TextView>

</sap:TableCell>

</sap:TableRow>

use the following:

<sap:TableRow ID="Table3_ItemTemplate">

<sap:TableCell ID="Table3_au_id" Title="au_id">

<sap:LinkToURL ID="linkToURL1" Target="_BLANK" Text='<%# DataBinder.Eval(Container.Parent, "DataSourceRow.DataItem.au_id") %>'>

</sap:LinkToURL>

</sap:TableCell>

</sap:TableRow>

3. In the ItemDataBound event handler of the table control:

private void Table4_ItemDatabound(object sender, SAP.Web.UI.Controls.Table.ItemEventArgs e)

{

TextView currentContent = ((TableCell) e.Item.Cells[0]).TableCellContent;

((TableCell) e.Item.Cells[0]).TableCellContent=new LinkToURL(currentContent.Text);

}