Delete a row and update Panel embedded in a repeater

guyneo
guyneo used Ask the Experts™
on
Hi Experts,
I am trying to display some library data in the following way.
Display categories
and
in each category display the books that were checked out in that category.
Each book has check out date and checkin date. a couple of check boxes and a delete button.
I would like to delete  the book or row and update its updatePanel accordingly
So I use a repeater for the categories and then I put in an Update Panel which has the nested repeater in it. The nested repeater displays the books that were checked out.
So the delete button is in this nested repeater for each row.
What is the best way to do the deletion or save each category.
I have tried to identify the row where  the delete button was clicked by using the scriptmanager.
no luck. What I am missing?
Thanks in advance guys
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013

Commented:
How are you binding your child repeaters?
I think you will have to rebind your parent Repeater to update the child repeater content.

Author

Commented:
Binding the child repeater the very first time?
newbie in ASP.NET so please bear with me.
I am using two queries. One for Categories and the another for the books in the category.
I am creating a Data Relation with these two result sets. I bind this DataSet to the main repeater and then
inside the itemDataBound method  I bind the nested repeater.(by creating a chidView and assigning it to the DataSource).

I am assuming that I have to rebind after making the changes in the DB.
However I have not reached that step. I am trying to find the ID of the Row which sent the delete command. And was not successful  Can you guide me here on how to determine which row needs to be deleted and how to make sure the child repeater is updated
Top Expert 2013
Commented:
1: Add CommandArgument field to your Delete Button and set it as your primary ID.
2: Handle  ItemCommand event of your child repeater.  You can get the commandargument in the handler.
3: Perform Delete
4: Rebind the parent Repeater.

Code Sample.

Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Author

Commented:
Thanks guru.
if I rebind the parent repeater. Won't it refresh the whole page?
Or will it refresh only the update panel it came from?
The main repeater has an update panel in the item template which contains all the data/controls
Top Expert 2013

Commented:
Put your parent Repeater inside update panel to avoid the entire page refresh.

Author

Commented:
Thanks Guru.  Can't thank you enough

Author

Commented:
For other people who come searching the solution to this problem.
If the above solution does not solve your problem here are the things to check.
1) Make sure you ItemCommand method is bound properly
2) Enable State View: Turn on and off for the Repeater. If you have this in ContentPlaceHolder, then you need to toggle EnableStateView to see if thats the source of your problem.
3)If you are using a Nested Repeater and ItemCommand is not firing, bind it in aspx page in the repeater tag itself with onItemCommand
http://weblogs.asp.net/nannettethacker/archive/2009/10/30/nested-repeater-addhandler-itemcommand-not-firing.aspx
4) Make sure you are rebinding the repeater properly

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial