Hein,
Thanx for the replies, but I seemed to forget to mention one thing. My
application uses C# webforms, so I can't use
System.Windows. Forms.BindingCo ntext.
I can think of two possible ways.
First, a DataGrid:
<ASP:DATAGRID id="myDataGrid " runat="server"
onitemcommand=" myDataGrid_Item Command">
<COLUMNS>
<ASP:BUTTONCOLU MN HeaderText="Sel ect Row"
ButtontType="Pu shButton"
Text="Select"
CommandName="Se lectRow">
</ASP:BUTTONCOLUM N>
<ASP:BOUNDCOLUM N HeaderText="MyI D" datafield="MyID ">
</ASP:BOUNDCOLUMN >
</COLUMNS>
</ASP:DATAGRID>
Then in your code behind file either:
1. Store the DataSet for the Grid in Session State (depending on its size)
and:
protected void myDataGrid_Item Command(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
TableCell myID = e.Item.Cells[1];
string key = myID.Text;
DataRow[] dr =
((DataSet)Sessi on["MyDataSet"]).Tables[0].Select("MyID=" + key);
}
or
(2) go back to the database with the id and get the single record:
protected void myDataGrid_Item Command(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
TableCell myID = e.Item.Cells[1];
int id = int.Parse(myID. Text);
if(((Button)e.C ommandSource).C ommandName == "SelectRow" )
{
DataRow dr = // fetch the record from the database using the id
}
}
---
Steven Wood