I have a paginated GridView on an ASP.NET page. In the DataBound event of the GridView control, I am attempting to update the OnClick event of each cell in the row to window.open() a new page using a field in the underlying DataTable that is not displayed in the GridView. However, the GridView DataSource propety is null, as is the GridViewRow DataItem property. The GridView's DataKeys has a Count of 0. The paginated DataSet has 20 rows and is being rendered properly, I just can't find the underlying data to pull the ID needed for the window.open() call.
I have followed asp.net's guide when constructing my page:
So I have a DAL -> BLL -> ObjectDataSource -> GridView. The ID column is being hidden in the GridView:
<asp:GridView ID="pdfdocuments" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="pdfods" PageSize="20"
ondatabound="pdfdocuments_DataBound">
<PagerSettings Mode="NumericFirstLast" />
<Columns>
<asp:BoundField DataField="pdf_id" HeaderText="pdf_id" InsertVisible="False"
ReadOnly="True" SortExpression="pdf_id" Visible="False" />
...
</Columns>
<HeaderStyle BackColor="#FFCC99" />
<AlternatingRowStyle BackColor="#FFFFCC" />
</asp:GridView>
How do I access the pdf_id value in the underlying DataTable?