cancel
Showing results for 
Search instead for 
Did you mean: 

Getting content from table. Urgent!

Former Member
0 Kudos

Hi guys!

I am trying to get a value from a field in table when I press it(Table1_LeadSelect), any ideas?

Using PDK2.0.

Regards,

Simon

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

If your Table is databound, you best take the value directly from the datasource. The LeadSelect's event args contain the index.

Else you need to look into the selected Row, it contains several columns, where each contains a "CellContents" or "TableCellEditor", which can be any controle, e.g. a TextView.

Former Member
0 Kudos

Hi Reiner

I tried to use the event args but i don't get any methods.

 
private void Table2_LeadSelect(object sender, SAP.Web.UI.Controls.Table.LeadSelectEventArgs e)
		{
			TextView7.Text = e.
		}

Any idea why?

Simon

reiner_hille-doering
Active Contributor
0 Kudos

You mean that IntelliSense doesn't work - doesn'tg show you anything? Anyway, you should be able to go to the documentation of LeadSelectEventArgs and see what's in it.

Former Member
0 Kudos

Yes it was only IntelliSense not working, but can't use e.Row since ID in sapTable is not the same as ID in database.

So I tried:


private void Table2_LeadSelect(object sender, SAP.Web.UI.Controls.Table.LeadSelectEventArgs e)
		{
			TextView7.Text = Table2_ID.TableCellContent.ToString(); // returns SAP.Web.UI.Controls.TextView
			TextView7.Text = Table2.SelectedKeys.IndexOf(0).ToString(); //tried with 0,1,2,"0",ID,"ID"; returns -1
			
		}

None of these seemed to work for my purpose..

Simon

reiner_hille-doering
Active Contributor
0 Kudos

What you write sounds to me that your table is databound.

In this case you can use the Row property of e to access the row directly on your datasource, e.g.

Table2.DataSource = dataset.Tables["MyTab"].DefaultView;

...

private void Table2_LeadSelect(object sender, SAP.Web.UI.Controls.Table.LeadSelectEventArgs e)
{					
  DataRowView row = dataset1.Tables["MyTab"].DefaultView[e.Row];
 textView7.Text = row[e.Col].ToString();
}

Former Member
0 Kudos

I'm using stored procedure and designer in VS.

Your example didn't display anything.

Can I use a button in table to return ID(value)?

Like this?

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/dotnet/pdk for .net/developer's%20Guide%20PDK%202.0%20for%20.NET/index.html

Regards,

Simon

Former Member
0 Kudos

OK found out how to print content from table using eLearning on sdn.sap.com, under the topic

"Developing iViews Using the SAP PDK for .NET"

and the code goes:


private void Table1_LeadSelect(object sender, SAP.Web.UI.Controls.Table.LeadSelectEventArgs e)
		{
			this.Write(dataSet11.Get_Contact.Rows[e.Row][dataSet11.Get_Contact.ACTOR_IDColumn].ToString());
		}

reiner_hille-doering
Active Contributor
0 Kudos

Isn't too different from what I posted for you, rigt?

Answers (0)