HELP !!! ObjectDataSource Delete Parameter Problem ASP.NET 2.0

Discussion in 'ASP .Net' started by Microsoft news, Mar 15, 2005.

  1. Hi,

    I have a problem with delete method:

    public static int DeleteEmployee(string original_EmployeeId)

    {

    return ClassDB.DeleteEmployee(original_EmployeeId);

    }



    And in aspx :

    <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server"
    DeleteMethod="DeleteEmployee" TypeName="BusinessObject"
    SortParameterName="sortExpression" ></asp:ObjectDataSource>

    Any advice please I have a pb to pass parameter !!!!

    I tried also with <DeleteParameter> ... the same pb



    Thanks

    Tarek.
     
    Microsoft news, Mar 15, 2005
    #1
    1. Advertising

  2. Hi again,

    I solved the problem , I added the DataKeyNames for the GridView and this is
    logical because when you need to delete something you should use the primary
    key (by mistake DataKeyNames not defined), and i used the same code but
    attention for (original_)

    public static int DeleteEmployee(string original_EmployeeId)
    {
    return ClassDB.DeleteEmployee(original_EmployeeId);
    }

    And in aspx :
    <asp:GridView ............ DataKeyNames="EmployeeId" >.....</asp:GridView>

    <asp:ObjectDataSource ID="ObjectDataSource1" Runat="server"
    DeleteMethod="DeleteEmployee" TypeName="BusinessObject"
    SortParameterName="sortExpression" ></asp:ObjectDataSource>

    Thanks,

    Tarek


    "" <> wrote in message
    news:...
    > Could you define your "problem"?
    >
     
    Microsoft news, Mar 16, 2005
    #2
    1. Advertising

  3. Microsoft news

    Guest

    Could you define your "problem"?
     
    , Mar 16, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9obiBCYWlsZXk=?=

    FormView and ObjectDataSource - Delete doesn't work

    =?Utf-8?B?Sm9obiBCYWlsZXk=?=, Jun 3, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,407
    =?Utf-8?B?Sm9obiBCYWlsZXk=?=
    Jun 3, 2005
  2. =?Utf-8?B?U2hhbmVfU0RF?=

    Delete not working from ForView through ObjectDataSource

    =?Utf-8?B?U2hhbmVfU0RF?=, May 3, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    412
    =?Utf-8?B?U2hhbmVfU0RF?=
    May 3, 2006
  3. Jürgen Bayer

    Delete with ObjectDataSource does not work

    Jürgen Bayer, May 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,235
    Jürgen Bayer
    May 16, 2006
  4. news.eternal-september.org
    Replies:
    0
    Views:
    611
    news.eternal-september.org
    Feb 2, 2010
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    267
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page