私はしばらくこれに取り組んできましたが、私の DetailsView が実際にそれ自体で正常に動作することに気付きました (別のページでテストしました)。
しかし、ページのタブ レイアウトに配置して [編集] をクリックすると、更新時にデータベース内のすべての値が null 値でクリアされます。
たとえば、次のページがあります: http://pactlegacy.com/sentinel/employeeprofile.aspx?curEmp=3
詳細ビューは次のとおりです。
<div id="tab-general" class="tabs-content">
<div class="avatar">
<h3>General Information</h3>
</div>
<fieldset class="grey-bg">
<legend>Required fields</legend>
<div class="colx3-left-double">
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px"
AutoGenerateRows="False" DataKeyNames="ID" DataSourceID="SqlDataSource1">
<Fields>
<asp:CommandField ShowEditButton="True" ButtonType="Button"/>
<asp:BoundField DataField="FirstName" HeaderText="First Name"
SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="Last Name"
SortExpression="LastName" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:BoundField DataField="JobID" HeaderText="JobID" SortExpression="JobID" />
<asp:BoundField DataField="SupervisorID" HeaderText="SupervisorID"
SortExpression="SupervisorID" />
<asp:BoundField DataField="HireDate" HeaderText="Hire Date"
SortExpression="HireDate" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" />
<asp:CommandField ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dbConnectionString %>"
DeleteCommand="DELETE FROM [Users] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [Users] ([ClientID], [UserName], [Password], [FirstName], [LastName], [Email], [JobID], [SupervisorID], [HireDate], [Status]) VALUES (@ClientID, @UserName, @Password, @FirstName, @LastName, @Email, @JobID, @SupervisorID, @HireDate, @Status)"
ProviderName="<%$ ConnectionStrings:dbConnectionString.ProviderName %>"
SelectCommand="SELECT [ID], [ClientID], [UserName], [Password], [FirstName], [LastName], [Email], [JobID], [SupervisorID], [HireDate], [Status] FROM [Users] WHERE [ID] = @ID"
UpdateCommand="UPDATE [Users] SET [ClientID] = @ClientID, [UserName] = @UserName, [Password] = @Password, [FirstName] = @FirstName, [LastName] = @LastName, [Email] = @Email, [JobID] = @JobID, [SupervisorID] = @SupervisorID, [HireDate] = @HireDate, [Status] = @Status WHERE [ID] = @ID">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="curEmp" Type="Int64" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ClientID" Type="Int64" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="JobID" Type="Double" />
<asp:Parameter Name="SupervisorID" Type="Double" />
<asp:Parameter Name="HireDate" Type="DateTime" />
<asp:Parameter Name="Status" Type="String" />
<asp:Parameter Name="ID" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</fieldset>
</div>
なぜこれが起こっているのか誰にも分かりますか?タブ レイアウト内で DetailsView を適切に更新するには、何を変更する必要がありますか?