我有gridview
一个sqldatasource
包含 7 个值的值。gridview datakeynames
是equipment_ID
;_ 其余的是常规字段。
我正在尝试使用e.values("BME_No")
within gridview_rowdeleted
,但它是空的。同时,e.values("equipment_name")
已满,e.values.count
节目values
是 5. values
应该是 6,不包括datakeyname equipment_ID
.
从这里的文章{没有提供网址},我看到datakeynames
被排除在values
. 另一方面,BME_No
不是datakeyname
。
我应该如何进行?
sql数据源:
<asp:SqlDataSource ID="SqlDataSource_GV" runat="server" ConnectionString="<%$ ConnectionStrings:MedicalEquipmentLibrary_DBConnectionString %>"
SelectCommand="Select_Equipments" SelectCommandType="StoredProcedure" UpdateCommand="Update_Equipment"
UpdateCommandType="StoredProcedure" CancelSelectOnNullParameter="False" DeleteCommand="Delete_Equipment"
DeleteCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="txtSearch" Name="BME_No" PropertyName="Text" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="Equipment_ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Equipment_ID" Type="Int32" />
<asp:Parameter Name="BME_No" Type="Int32" />
<asp:Parameter Name="Equipment_Name" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Model_Name" Type="String" />
<asp:Parameter Name="Vendor_Name" Type="String" />
<asp:Parameter Name="Manufacture_Name" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
Gridview_rowdeleted 事件:
Protected Sub GV_Main_RowDeleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles GV_Main.RowDeleted
lblMessage.ForeColor = Drawing.Color.Red
lblMessage.Visible = True
lblMessage.Text = "Equipment " + e.Values("BME_No") + " is deleted."
End Sub