locked
objectdatasource delete not working RRS feed

  • Question

  • User546633074 posted

    <asp:UpdatePanel ID="UpdatePanelProduct" runat="server">
    <ContentTemplate>

    <GridView ID="BulkEditGridViewJobTitle" runat="server" DataSourceID="ObjectDataSourceWorkFlowAdmin"
    DataKeyNames="WorkFlowAdminUsersID" ShowHeaderAction="True"
    PageSelectorActionText="Go" AutoGenerateColumns="False" >
    <Columns>

    <TemplateField HeaderText="Delete">
    <EditItemTemplate>
    <asp:CheckBox ID="Delete" runat="server"></asp:CheckBox>
    <CheckBox ID="CheckBoxJobTitleExtenderEdit" runat="server" TargetControlID="Delete">
    </CheckBox>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:CheckBox ID="CheckBoxSelectItem" runat="server" Enabled="False"></asp:CheckBox>
    </ItemTemplate>
    </TemplateField>

    <TemplateField HeaderText="User Name">

    <HeaderActionTemplate>
    <asp:TextBox ID="TextBoxUserNameHeaderAction1" runat="server" SkinID="Wide"></asp:TextBox>
    </HeaderActionTemplate>
    <EditItemTemplate>
    <asp:Label runat="server" ID="ID" Text='<%# Bind("WorkFlowAdminUsersID") %>' />
    <asp:DropDownList ID="ddlUserNameEdit" runat="server" DataSourceID="UsersDataSource"
    SelectedValue='<%#DataBinder.Eval(Container.DataItem,"UserID") %>' DataTextField="Name"
    SkinID="Wide" DataValueField="UserID">
    </asp:DropDownList>
    </EditItemTemplate>
    </TemplateField>
    <TemplateField ShowHeader="False">
    <InsertItemTemplate>
    <asp:Button ID="DeleteRowButton" runat="server" Text="Delete" />
    </InsertItemTemplate>
    </TemplateField>
    </Columns>
    </GridView>

    </ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="ButtonSave"></asp:AsyncPostBackTrigger>
    </Triggers>
    </asp:UpdatePanel>

    <tr align="center">
    <td align="center">
    <asp:Button ID="ButtonSave" runat="server" Text="Save" ValidationGroup="PageValidationGroup"
    OnClick="ButtonSave_Click" />
    </td>
    </tr>

    <asp:ObjectDataSource ID="ObjectDataSourceWorkFlowAdmin" runat="server"
    TypeName="TenderBusinessLayer.BLTenderADWorkFlowAdminUser" SelectMethod="GetUser"
    DeleteMethod="Delete">
    <SelectParameters>
    <asp:Parameter Name="workflowID" Type="Int32" DefaultValue="1" />
    </SelectParameters>
    <DeleteParameters>
    <asp:Parameter Name="WorkFlowAdminUsersID" Type="Int32" />
    </DeleteParameters>
    </asp:ObjectDataSource>

    -------------------------------------------------------

    Select , insert and update  work fine ,but delete not working

     public void Delete(int WorkFlowAdminUsersID)

    {
    //Delete statment that will cal DA layer
    }

    Thursday, October 10, 2013 8:41 AM

Answers

  • User-1360095595 posted

    Try setting the following property on the delete button: CommandName="Delete"

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 10, 2013 8:57 AM

All replies

  • User-1360095595 posted

    Try setting the following property on the delete button: CommandName="Delete"

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 10, 2013 8:57 AM
  • User-1716253493 posted
    Place the button in ItemTemplate, then don't forget to set CommandName property like Metal Asp.Net said.
    Thursday, October 10, 2013 9:39 AM
  • User546633074 posted

    thanks metalasp for your replay ,

    but i have others scenario, save button is a responsible of add and delete

    when i select checkbox and save ,i take selected and delete it in BL

    Saturday, October 12, 2013 3:00 AM
  • User-933407369 posted

    hi  Ahmed Osman,

    you have tried to set CommandName property like Metal Asp.Net said.

    Now, objectdatasource delete still not working  for you?

    you provide your complete project to SkyDrive in order to help us to understand your issue better.

    Wednesday, October 16, 2013 10:56 PM