Gridview RowDataBound 中获取数据库ID

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
        BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3"
        DataKeyNames="surveyid" Width="600" OnRowDataBound="GridView1_RowDataBound">

 中获取数据库ID:

GridView1.DataKeys[e.Row.DataItemIndex].Value

你可能感兴趣的:(GridView)