on 08-12-2005 4:15 PM
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
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.