Hi
You can use following steps to do your work.
1) Get all data, including data to be shown in datagrid
(e.g. recordID, description, and others) and detailed data
(e.g. Course Name, Course Date, Trainer, and Location) to
fill into a datatable.
2) Build a datagrid with DataKeyField = "recordID" and few
BoundColumns (for recorded, description, and so on) and a
ButtonColumn.
3) Bind the datagrid with the datatable, and in the mean
time save the datatable in Session.
4) Build ItemCommand event. In the event retrieve clicked
recordID and then pull detailed data from datatable in
Session by following code:
string recordID = datagrid.DataKeys
[e.Item.ItemIndex].ToString();
DataTable data = (DataTable)Session["source"];
DataView dv = data.DefaultView;
dv.RowFilter = "recordID='" + recordID + "'";
DataRowView drv = dv[0];
string CourseName = drv["CourseName"];
string CourseDate = drv["CourseDate"];
string Trainer = drv["Trainer"];
string Location = drv["Location"];
HTH
Elton Wang
>-----Original Message-----
>Hi there,
>
>This might be a simple enough question for most of you.
But I am pulling
>my hair out with this.
>
>I have a datagrid populated from a database. Its a
booking form. You
>push a button column to select the row. And now I need to
give some
>specific details from that row in to a label.
>Lets say Course Name, Course Date, Trainer, and Location.
>
>I have NO idea how to get those specific details
populated in to a
>label. How do I select those specific parts from the data
reader? I know
>the record. And I know I have the info. But I just want
the specific parts!
>
>Thanks for your help,
>Euan
>.
>