Avatar of guyneo
 asked on

Delete a row and update Panel embedded in a repeater

Hi Experts,
I am trying to display some library data in the following way.
Display categories
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
.NET ProgrammingASP.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon

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

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

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

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

Thanks Guru.  Can't thank you enough

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
4) Make sure you are rebinding the repeater properly
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.