<asp:UpdatePanel ID="UpdatePanel10" runat="server">
<ContentTemplate>
<center>
<asp:GridView ID="gridInboxMessage" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="LinqDataSource1" OnSelectedIndexChanged="gridInboxMessage_SelectedIndexChanged"
onrowdeleted="gridInboxMessage_RowDeleted"
onrowdeleting="gridInboxMessage_RowDeleting">
<Columns>
<asp:CommandField ShowSelectButton="True" SelectText="show text" />
<asp:TemplateField >
<ItemTemplate>
<asp:Button ID="btnDeleteInbox" Text="delete" OnClick="btnDeleteInbox_Click" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Row" HeaderText="row" ReadOnly="True" SortExpression="Row" />
<asp:TemplateField SortExpression="Body" HeaderText="متن">
<ItemTemplate>
<asp:Label ID="MyBody" runat="server" Text='<%# TruncateText(Eval("Body"))%>'>
</asp:Label>
<asp:Label ID="fullBodyRecieve" Visible="false" runat="server" Text='<%# Eval("Body")%>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<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">
<WhereParameters>
<asp:QueryStringParameter Name="Receptor" QueryStringField="idCompany" Type="String" />
</WhereParameters>
</asp:LinqDataSource>
</ContentTemplate>
</asp:UpdatePanel>
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();
}
btnDeleteInbox_Click
не работает ?? Этот метод никогда не выполняется
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();
}
gridInboxMessage_RowDeleted
не работает ?? Этот метод никогда не выполняется
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();
}
gridInboxMessage_RowDeleting
не работает ?? Этот метод никогда не выполняется