I presumed you are working on with ASP.Net, since you are talking about Main Page and Next page.
In HTML code, at your data grid declartion, you can set your asp:ButtonColumn to be the DataTextField type, so user can able to select any job reference numbers. The you need to use CommandName, ie CommandName="JobSelected"
On your coding use the event ItemCommand on your datagrid. The object, e will generated auatomatically as one of the event's passing parameter, that will contains name of your datagrid event.
so, using a string var to catch event name,
string cmd=e.CommandName; (C#)
dim cmd as string = e.CommandName (
VB.Net)
1. One you know the command name use switch (C#) or Case Select (
VB.Net) to get your command to activate next.
2. You need to capture the row that your user had clicked. If you used a datatable to bind your datagrid, the row index of datagrid must be the same as your table. Using e.Item.DataSetIndex to find the row index. Once the row index found, you can access the rest of your data in the table which refered to user selected row on the datagrid.
3. Once you capture ref number, you can get all the rest of your data and pass it to the next page.
Hope I made myself clear, I am not a ASP pro just a novice. I had done similar thing to your problem, hope it helps