Hello.

On Jan 5, 11:39 am, Markei54545 <[email protected]> wrote:
> I want to know if there is anyway I can read the position of the first
> dataset, and pass it on to the second one so that the databound fields
> in the second form reflect those selected in the first.
>
> Any help gratefully received.

If I follow you, I am not fluen but I had similar problem I think (I
work with C#.2010 but it should be similar for those controls - I
assume we are talking about ASP).
GridView shows just "first" datatable of DataSet you set as
datasource. It does it with naming container (adding row ID to control
ID). So, you can access controls with method FindControl called on
DataRow.
So, having method called on row you have row ID (which is also row of
datatable). If you set it with ItemTemplate try something as
sender.parent.parent (this is row). I did it following:
Session["PrevSelection"] = ((Button)sender).ID;

Session["PrevRow"] = ((GridViewRow)
((Button)sender).Parent.Parent).RowIndex;
You can use session or hidden or whatever you like.
Than, in next request:
int iRowIndx = (int)Session["PrevRow"];

Button btn =
(Button)Schedule.Rows[iRowIndx].FindControl((String)Session["PrevSelection"]);

Regards,
Pawel

Reply via email to