我做了無形的第一列在我的GridView:我怎麼可以從GridView中的不可見單元格ID?
<asp:GridView ID="tableResults" runat="server" DataMember="Table"
EnableModelValidation="True" CssClass = "GridViewStyle"
AutoGenerateColumns="False" OnRowDataBound = "tableResults_DataBound"
OnRowDeleting = "tableResults_RowDeleting" AutoGenerateDeleteButton="True">
<HeaderStyle CssClass = "GridViewHeaderStyle" />
<RowStyle CssClass = "GridViewRowStyle"/>
<Columns>
<asp:BoundField DataField="I_ID" Visible="false" HeaderText=""/>
<asp:BoundField DataField="I_MAJOR" HeaderText="Major"/>
<asp:BoundField DataField="I_MINOR" HeaderText="Minor"/>
<asp:BoundField DataField="I_RELEASE" HeaderText="Release"/>
<asp:BoundField DataField="I_BUILD" HeaderText="Build"/>
</Columns>
</asp:GridView>
現在,當我得到第1欄是空值:
TableCell rowData = tableResults.Rows[e.RowIndex].Cells[1];
oracleCom.CommandText = "Delete From TBL_VERSIONS Where i_id = " + rowData.Text;
如果我沒有列visible = true
,我能得到的價值。但是這個專欄必須是不可見的。