How to update ASP.NET Repeater in real time?

3

I have a Repeater on a side div that receives the amount of products from the cart and needs to be updated with every click.

I have tried rpt.Databind() in the Click event but repeater only refreshes with a refresh of the browser .. Any suggestions?

    
asked by anonymous 18.03.2014 / 17:37

2 answers

3

You can use an update panel and put a trigger or event to refresh the page for every request you want.

Try something like this:

 GridView1.DataBind();
 UpdatePanel1.Update();

I hope it helps.

    
18.03.2014 / 18:02
1

You will have to do this using javascript on the client side, instead of using a repeater.

I recommend you use jQuery to do this, as well as a very good template plugin: link

You will probably have to get the element that needs to be updated, for example a div that contains the list of elements you want to update, and append it to insert each new item:

$("#idElementoContainerLista").append(htmlElemento);

Since the variable htmlElemento can be constructed using a string purely:

"<div>... mais html do elemento aqui...</div>"

Or by using the template plugin ... if the string option starts to get too complicated.

    
18.03.2014 / 17:45