Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

vb.NET - Datalist, Editing, Updating & Paging

Options
  • 27-02-2007 2:02am
    #1
    Registered Users Posts: 1,002 ✭✭✭


    I can successfully create a databound DataList.
    I can successfully create an Edit version of it and update the database through the DataList.
    I can also successfully page the results.

    But I can't combine the paging and the editing/updating.
    The _EditCommand toggles to edit mode.
    The _CancelCommand toggles back to read mode.
    The _DeleteCommand deletes the row using the id as the identifier (Dim id As Integer = Convert.ToInt32(AllPendingImages.DataKeys(e.Item.ItemIndex)))

    But the _UpdateCommand doesn't fire. The updateCommand works when the paging code is not added to the script.
    I rebind the data after each command and after I move forward/backward in the dataset.

    There is something I am missing, and I can't figure it out!! Any help appreciated! :confused:


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Post your code.


  • Registered Users Posts: 1,002 ✭✭✭MargeS


    I have uploaded the aspx and aspx.vb files.

    The datalist displays all the info about an uploaded image and info about the user who uploaded the image. The aim of the page is to accept or decline the image for publishing. (1= decline, 2= accept) using the imageId as the indentifier.

    Currently it all works until I go to edit mode.
    When I debug it seems to be setting the DataKey id to _Page so the wrong value is being passed to the stored procedures in
    Sub AllPendingImages_DeleteCommand and Sub AllPendingImages_UpdateCommand. These aren't firing. Actually the _Delete is firing after I hit the delete button a second time. :o

    I've been going around in circles with Page.IsPostBack because I think this is where the problem is. But I've been looking at it for so long now, I don't know any more! :(


  • Registered Users Posts: 1,002 ✭✭✭MargeS


    I've partly worked this out....

    I put If Page.IsPostBack Then around my DeleteCommand code. So this sub works.

    But going into edit mode for the UpdateCommand seems to change the value of id so I haven't got that part working yet.


  • Registered Users Posts: 1,002 ✭✭✭MargeS


    I finally got this to work. Yippee!
    I decided to try and get the same result by doing it a different way and in the process I figured out how to do it the first way. So now I can do it 2 different ways. If ya follow?? :D

    There is alot to be said for persistance!


Advertisement