on 04-18-2006 9:39 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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();
}
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
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());
}
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.