functions in update panel <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel10" runat="server"&gt; &lt;ContentTemplate&gt; &lt;center&gt; &lt;asp:GridView ID="gridInboxMessage" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="LinqDataSource1" OnSelectedIndexChanged="gridInboxMessage_SelectedIndexChanged" onrowdeleted="gridInboxMessage_RowDeleted" onrowdeleting="gridInboxMessage_RowDeleting"&gt; &lt;Columns&gt; &lt;asp:CommandField ShowSelectButton="True" SelectText="show text" /&gt; &lt;asp:TemplateField &gt; &lt;ItemTemplate&gt; &lt;asp:Button ID="btnDeleteInbox" Text="delete" OnClick="btnDeleteInbox_Click" runat="server" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="Row" HeaderText="row" ReadOnly="True" SortExpression="Row" /&gt; &lt;asp:TemplateField SortExpression="Body" HeaderText="متن"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="MyBody" runat="server" Text='&lt;%# TruncateText(Eval("Body"))%&gt;'&gt; &lt;/asp:Label&gt; &lt;asp:Label ID="fullBodyRecieve" Visible="false" runat="server" Text='&lt;%# Eval("Body")%&gt;'&gt; &lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;asp:LinqDataSource ID="LinqDataSource1" AutoSort="true" runat="server" ContextTypeName="DataClassesDataContext" Select="new (Row,Title, Body, Sender, Date1)" TableName="PrivateMessages" Where="Receptor == @Receptor" ondeleted="LinqDataSource1_Deleted" ondeleting="LinqDataSource1_Deleting"&gt; &lt;WhereParameters&gt; &lt;asp:QueryStringParameter Name="Receptor" QueryStringField="idCompany" Type="String" /&gt; &lt;/WhereParameters&gt; &lt;/asp:LinqDataSource&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <hr> <pre><code> protected void btnDeleteInbox_Click(object sender, EventArgs e) { GridViewRow row = gridInboxMessage.SelectedRow; var inboxMessage = (from b in dc.PrivateMessages where b.Row.ToString() == row.Cells[0].Text select b).Single(); dc.PrivateMessages.DeleteOnSubmit(inboxMessage); dc.SubmitChanges(); } </code></pre> <p><code>btnDeleteInbox_Click</code> doe not work??This method is never executed</p> <pre><code>protected void gridInboxMessage_RowDeleted(object sender, GridViewDeletedEventArgs e) { GridViewRow row = gridInboxMessage.SelectedRow; var inboxMessage = (from b in dc.PrivateMessages where b.Row.ToString() == row.Cells[0].Text select b).Single(); dc.PrivateMessages.DeleteOnSubmit(inboxMessage); dc.SubmitChanges(); } </code></pre> <p><code>gridInboxMessage_RowDeleted</code> doe not work??This method is never executed</p> <pre><code>protected void gridInboxMessage_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = gridInboxMessage.SelectedRow; var inboxMessage = (from b in dc.PrivateMessages where b.Row.ToString() == row.Cells[0].Text select b).Single(); dc.PrivateMessages.DeleteOnSubmit(inboxMessage); dc.SubmitChanges(); } </code></pre> <p><code>gridInboxMessage_RowDeleting</code> doe not work??This method is never executed</p>