這裏的SqlDataSource和DetailsView控件完整的源代碼:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:HADIConnectionString %>"
DeleteCommand="DELETE FROM "INDENT_FILE_NO" WHERE "FILE_NO_ID" = :original_FILE_NO_ID AND (("INDENT_ID" = :original_INDENT_ID) OR ("INDENT_ID" IS NULL AND :original_INDENT_ID IS NULL)) AND (("FILE_NO" = :original_FILE_NO) OR ("FILE_NO" IS NULL AND :original_FILE_NO IS NULL)) AND (("FILE_DESCRIPTION" = :original_FILE_DESCRIPTION) OR ("FILE_DESCRIPTION" IS NULL AND :original_FILE_DESCRIPTION IS NULL)) AND (("INDENTER" = :original_INDENTER) OR ("INDENTER" IS NULL AND :original_INDENTER IS NULL))" InsertCommand="INSERT INTO "INDENT_FILE_NO" ("FILE_NO_ID", "INDENT_ID", "FILE_NO", "FILE_DESCRIPTION", "INDENTER") VALUES (:FILE_NO_ID, :INDENT_ID, :FILE_NO, :FILE_DESCRIPTION, :INDENTER)" OldValuesParameterFormatString="original_{0}" ProviderName="<%$ ConnectionStrings:HADIConnectionString.ProviderName %>"
SelectCommand="SELECT * FROM "INDENT_FILE_NO" WHERE ("INDENT_ID" = :INDENT_ID)"
UpdateCommand="UPDATE "INDENT_FILE_NO" SET "INDENT_ID" = :INDENT_ID, "FILE_NO" = :FILE_NO, "FILE_DESCRIPTION" = :FILE_DESCRIPTION, "INDENTER" = :INDENTER WHERE "FILE_NO_ID" = :original_FILE_NO_ID AND (("INDENT_ID" = :original_INDENT_ID) OR ("INDENT_ID" IS NULL AND :original_INDENT_ID IS NULL)) AND (("FILE_NO" = :original_FILE_NO) OR ("FILE_NO" IS NULL AND :original_FILE_NO IS NULL)) AND (("FILE_DESCRIPTION" = :original_FILE_DESCRIPTION) OR ("FILE_DESCRIPTION" IS NULL AND :original_FILE_DESCRIPTION IS NULL)) AND (("INDENTER" = :original_INDENTER) OR ("INDENTER" IS NULL AND :original_INDENTER IS NULL))" ConflictDetection="CompareAllValues">
<UpdateParameters>
<asp:Parameter Name="INDENT_ID" Type="Decimal" />
<asp:Parameter Name="FILE_NO" Type="String" />
<asp:Parameter Name="FILE_DESCRIPTION" Type="String" />
<asp:Parameter Name="INDENTER" Type="String" />
<asp:Parameter Name="original_FILE_NO_ID" Type="Decimal" />
<asp:Parameter Name="original_INDENT_ID" Type="Decimal" />
<asp:Parameter Name="original_FILE_NO" Type="String" />
<asp:Parameter Name="original_FILE_DESCRIPTION" Type="String" />
<asp:Parameter Name="original_INDENTER" Type="String" />
</UpdateParameters>
詳情查看:
<asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataKeyNames="FILE_NO_ID" DataSourceID="SqlDataSource2" Height="50px" Width="287px" >
<Fields>
<asp:BoundField DataField="FILE_NO_ID" HeaderText="FILE_NO_ID" ReadOnly="True" SortExpression="FILE_NO_ID" Visible="False" />
<asp:BoundField DataField="INDENT_ID" HeaderText="INDENT_ID" SortExpression="INDENT_ID" Visible="False" />
<asp:BoundField DataField="FILE_NO" HeaderText="FILE_NO" SortExpression="FILE_NO" />
<asp:BoundField DataField="FILE_DESCRIPTION" HeaderText="FILE_DESCRIPTION" SortExpression="FILE_DESCRIPTION" />
<asp:BoundField DataField="INDENTER" HeaderText="INDENTER" SortExpression="INDENTER" />
<asp:CommandField ShowEditButton="True" ButtonType="Button" />
</Fields>
</asp:DetailsView>
但是現在,當我按下編輯鍵和編輯字段,然後對其進行更新,數據的領域保持不變。意味着沒有行動需要。
plz幫助。當我設置主要和Freign重點領域的「可見=假」更新不能正常工作。 – Awaidus