cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Table inside SAP Table of Netweaver

Former Member
0 Kudos

Hello experts,

I'm trying to develop one equivalent to Datagrid. For design purpose i want to add a table inside SAP table. SAP table allows only few instances to be applied to its cells. Jus like adding inputfield or a TextView i require a table to be added. Is it possible? I tried adding HTML table inside SAP table but it din't work! Or is there a way i can split the cell and associate controls to the split up section? Plz help me in this regard ASAP.

Thank you,

Madhesh.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

you can mail to my personal Id if this doesnot solve your problem.

Edited by: Ashutosh Sarwade on Dec 27, 2007 7:49 AM

Former Member
0 Kudos

Hi Madhesh,

I am able to SAP table in HTML table. Here is the sample code where I have added SAP table in the first cell of HTML table. Let me know if this solves your problem.

protected void Page_Load(object sender, EventArgs e)

{

BuildTable();

//Adding table inside a table

//code starts here

objParentTable.BorderColor = "#000000";

HtmlTableRow trHeader = new HtmlTableRow();

trHeader.ID = "trhdr0";

HtmlTableRow trHeader1 = new HtmlTableRow();

trHeader1.ID = "trhdr1";

HtmlTableCell tcellHeader = new HtmlTableCell();

tcellHeader.ID = "tcheadercell0";

tcellHeader.BgColor = "#999999";

TextView objTextViewHeader = new TextView();

objTextViewHeader.ID = "objtxtview0";

objTextViewHeader.Text = "Column1";

tcellHeader.Controls.Add(objTextViewHeader);

trHeader.Cells.Add(tcellHeader);

objParentTable.Visible = true;

objParentTable.Rows.Add(trHeader);

HtmlTableCell tcellHeader1 = new HtmlTableCell();

tcellHeader1.ID = "tcheadercell1";

tcellHeader1.BgColor = "#999999";

TextView objTextViewHeader1 = new TextView();

objTextViewHeader1.ID = "objtxtview1";

objTextViewHeader1.Text = "Column1";

tcellHeader1.Controls.Add(objTextViewHeader1);

trHeader.Cells.Add(tcellHeader1);

objParentTable.Visible = true;

objParentTable.Rows.Add(trHeader1);

HtmlTableRow trFirstRow = new HtmlTableRow();

trFirstRow.ID = "tr0";

HtmlTableCell tcellDetails = new HtmlTableCell();

tcellDetails.ID = "tc0";

tcellDetails.BgColor = "#ffffff";

TextView objTextViewDetails = new TextView();

objTextViewDetails.ID = "txtvw0";

objTextViewDetails.Text = "Hi";

//Add table inside the HTML table

tcellDetails.Controls.Add(objTableToAdd);

trFirstRow.Cells.Add(tcellDetails);

HtmlTableCell tcellDetails1 = new HtmlTableCell();

tcellDetails1.ID = "tc1";

tcellDetails1.BgColor = "#ffffff";

TextView objTextViewDetails1 = new TextView();

objTextViewDetails1.ID = "txtvw0";

objTextViewDetails1.Text = " How R U?";

tcellDetails1.Controls.Add(objTextViewDetails1);

trFirstRow.Cells.Add(tcellDetails1);

objParentTable.Rows.Add(trFirstRow);

//code end here

}

private void BuildTable()

{

objTableToAdd.Items.Clear();

objTableToAdd.NewRow();

((TextView)(objTableToAdd.Items[0].Cells[0].TableCellContent)).Text = "Table";

objTableToAdd.NewRow();

((TextView)(objTableToAdd.Items[0].Cells[1].TableCellContent)).Text = "to be added";

}

Regards,

Ashutosh

Edited by: Ashutosh Sarwade on Dec 27, 2007 7:39 AM

rima-sirich
Advisor
Advisor
0 Kudos

Hi Madhesh,

Unfortunately, it is not possible. The reason for it is the fact that control used as a table cell content should implement SAP.Web.UI.Controls.ITableCellEditor interface. SAP controls such as InputField, Checkbox, etc implement this interface therefore it is possible to use them inside the SAP Table.

Regarding splitting the table cell, it is not possible as well.

Regards,

Rima.

Former Member
0 Kudos

Hi Rima,

Thanks for ur rply. Will i be able to have 2 controls under the same cell atleast? I tried doing that but its displayin only the last found control. Is there any workaround to display both controls in the same cell.

Regards,

Madhesh

rima-sirich
Advisor
Advisor
0 Kudos

Hi Madhesh,

No, you can use only one control in the table cell. It seems that you have 2 following options:

1. To use 2 columns with one control in each table cell instead of 1 column with 2 controls in each table cell ( if it is applicable to your use case ).

2. To use Datagrid control and then use SAP Portal Style Designer in order to give it SAP look & feel. See following [documentation|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/lw/uuid/95628888-0d01-0010-7d97-f0d771999d0f] go to table of contents, Programming with PDK for .NET -> Using Portal Style Designer chapter.

Regards,

Rima.