Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate Command doesn't work on a specific page
    primarykey
    data
    text
    <p>I have been having issues with the update command on a page I have. I have 4 gridviews and 4 detailsviews and none of them will update with the update command. I can insert and delete but update doesn't work. The update button doesn't cause a post back, it just sits there.</p> <p>I created a new page and added a detailsview and connected it to the same database and same table, and in that page the update command worked perfectly. I even copied and pasted the command queries to the detailsviews on the other page, but no success.</p> <p>I'm thinking is an issue with the buttons, but why the default update link button doesn't work?</p> <p>I am using ASP.NET, C# and SQL Server 2008.</p> <p>I did notice that the update button on the detailsview that works shows: <code>javascript:__doPostBack('DetailsView1$ctl02','')</code> on the status bar.</p> <p>But the update button for the one that doesn't work shows this: <code>WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$DetailsView2$ctl02", "", true, "", "", false, true))</code> </p> <p><strong>Here's the code for the detailsview that works</strong></p> <pre><code>&lt;asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="WorkshopName,WorkshopBeginingDate,WorkshopLocation" DataSourceID="SqlDataSource1" Height="50px" Width="125px"&gt; &lt;Fields&gt; &lt;asp:BoundField DataField="WorkshopName" HeaderText="WorkshopName" ReadOnly="True" SortExpression="WorkshopName" /&gt; &lt;asp:BoundField DataField="WorkshopBeginingDate" HeaderText="WorkshopBeginingDate" ReadOnly="True" SortExpression="WorkshopBeginingDate" /&gt; &lt;asp:BoundField DataField="WorkshopEndingDate" HeaderText="WorkshopEndingDate" SortExpression="WorkshopEndingDate" /&gt; &lt;asp:BoundField DataField="WorkshopLocation" HeaderText="WorkshopLocation" ReadOnly="True" SortExpression="WorkshopLocation" /&gt; &lt;asp:CommandField ShowEditButton="True" /&gt; &lt;/Fields&gt; &lt;/asp:DetailsView&gt; </code></pre> <p><strong>This is the code for one that doesn't work</strong></p> <pre><code> &lt;asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" DataKeyNames="WorkshopName,WorkshopBeginingDate,WorkshopLocation" DataSourceID="SqlDataSource20" Height="50px" Width="125px"&gt; &lt;Fields&gt; &lt;asp:BoundField DataField="WorkshopName" HeaderText="WorkshopName" ReadOnly="True" SortExpression="WorkshopName" /&gt; &lt;asp:BoundField DataField="WorkshopBeginingDate" HeaderText="WorkshopBeginingDate" ReadOnly="True" SortExpression="WorkshopBeginingDate" /&gt; &lt;asp:BoundField DataField="WorkshopEndingDate" HeaderText="WorkshopEndingDate" SortExpression="WorkshopEndingDate" /&gt; &lt;asp:BoundField DataField="WorkshopLocation" HeaderText="WorkshopLocation" ReadOnly="True" SortExpression="WorkshopLocation" /&gt; &lt;asp:CommandField ShowEditButton="True" /&gt; &lt;/Fields&gt; &lt;/asp:DetailsView&gt; **This is the SQL Data source code for the one that doesn't work, it is also the same on the one that works, except for the Datasource ID.** &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="&lt;%$ ConnectionStrings:WildLife_EducationConnectionString %&gt;" DeleteCommand="DELETE FROM [tblWorkshop] WHERE [WorkshopName] = @original_WorkshopName AND [WorkshopBeginingDate] = @original_WorkshopBeginingDate AND [WorkshopLocation] = @original_WorkshopLocation AND (([WorkshopEndingDate] = @original_WorkshopEndingDate) OR ([WorkshopEndingDate] IS NULL AND @original_WorkshopEndingDate IS NULL))" InsertCommand="INSERT INTO [tblWorkshop] ([WorkshopName], [WorkshopBeginingDate], [WorkshopEndingDate], [WorkshopLocation]) VALUES (@WorkshopName, @WorkshopBeginingDate, @WorkshopEndingDate, @WorkshopLocation)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [WorkshopName], [WorkshopBeginingDate], [WorkshopEndingDate], [WorkshopLocation] FROM [tblWorkshop]" UpdateCommand="UPDATE [tblWorkshop] SET [WorkshopEndingDate] = @WorkshopEndingDate WHERE [WorkshopName] = @original_WorkshopName AND [WorkshopBeginingDate] = @original_WorkshopBeginingDate AND [WorkshopLocation] = @original_WorkshopLocation AND (([WorkshopEndingDate] = @original_WorkshopEndingDate) OR ([WorkshopEndingDate] IS NULL AND @original_WorkshopEndingDate IS NULL))"&gt; &lt;DeleteParameters&gt; &lt;asp:Parameter Name="original_WorkshopName" Type="String" /&gt; &lt;asp:Parameter DbType="Date" Name="original_WorkshopBeginingDate" /&gt; &lt;asp:Parameter Name="original_WorkshopLocation" Type="String" /&gt; &lt;asp:Parameter DbType="Date" Name="original_WorkshopEndingDate" /&gt; &lt;/DeleteParameters&gt; &lt;InsertParameters&gt; &lt;asp:Parameter Name="WorkshopName" Type="String" /&gt; &lt;asp:Parameter DbType="Date" Name="WorkshopBeginingDate" /&gt; &lt;asp:Parameter DbType="Date" Name="WorkshopEndingDate" /&gt; &lt;asp:Parameter Name="WorkshopLocation" Type="String" /&gt; &lt;/InsertParameters&gt; &lt;UpdateParameters&gt; &lt;asp:Parameter DbType="Date" Name="WorkshopEndingDate" /&gt; &lt;asp:Parameter Name="original_WorkshopName" Type="String" /&gt; &lt;asp:Parameter DbType="Date" Name="original_WorkshopBeginingDate" /&gt; &lt;asp:Parameter Name="original_WorkshopLocation" Type="String" /&gt; &lt;asp:Parameter DbType="Date" Name="original_WorkshopEndingDate" /&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload