Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is working solution (You may want to improve it):</p> <pre><code>&lt;asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" AllowPaging="true" OnItemDeleted="FormView1_ItemDeleted" ondatabound="FormView1_DataBound" &gt; &lt;ItemTemplate&gt; Key: &lt;asp:Label ID="KeyLabel" runat="server" Text='&lt;%# Bind("Key") %&gt;' /&gt; &lt;br /&gt; Value: &lt;asp:Label ID="ValueLabel" runat="server" Text='&lt;%# Bind("Value") %&gt;' /&gt; &lt;br /&gt; &lt;asp:Button ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete" /&gt; &lt;hr /&gt; &lt;asp:Label ID="Label1" runat="server" Text="does not work"&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:FormView&gt; &lt;asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetList" DeleteMethod="Delete" TypeName="MyProject.Repository"&gt; &lt;DeleteParameters&gt; &lt;asp:Parameter Name="key" Type="Int32" /&gt; &lt;/DeleteParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre> <p>codebehind:</p> <pre><code>public string MyProperty { get; set; } protected void FormView1_DataBound(object sender, EventArgs e) { if (!string.IsNullOrEmpty(MyProperty)) { Label l = FormView1.FindControl("Label1") as Label; l.Text = "it works. " + MyProperty; MyProperty = null; } } protected void FormView1_ItemDeleted(object sender, FormViewDeletedEventArgs e) { if (e.Exception != null) { MyProperty = e.Exception.Message; e.ExceptionHandled = true; } } </code></pre>
 

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