Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think I see your problem. Try adding a DataKeyNames paramater to the GridView with the ID of the row you want to act on. Next remove the Triggers section as you won't need them for what you are doing. Since you are wanting to act on something change the CommandField to one of the other options such as Delete which you aren't currently using. Next modify your ObjectDataSource to define a DeleteMethod in your myNamespace.ItemMgr that accepts the Id (DataKeyNames paramater) from the GridView and performs the task you wish to perform. After the method returns it will refresh the GridView from the SelectMethod defined.</p> <pre><code> &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" PagerSettings-Visible="true" EnableViewState="False" DataKeyNames="Id" &gt; &lt;Columns&gt; &lt;asp:CommandField DeleteImageUrl="/images/icon.gif" DeleteText="Some Text" ShowDeleteButton="True" ButtonType="Image" /&gt; &lt;asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" /&gt; &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="myDeleteMethod" SelectMethod="mySelectMethod" TypeName="myNamespace.ItemMgr"&gt; &lt;/asp:ObjectDataSource&gt; </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