How to update ASP.NET Repeater in real time?

Asked

Viewed 538 times

3

I have a Repeater in a lateral div that receives the quantity of products from the cart and needs to be updated every click.

I’ve tried to rpt.Databind() in the Click event but the Reset only updates with a browser refresh.. Any suggestions?

  • Have you provide us the event code Click?

  • I managed to resolve calling updatePanel.Update();

  • Great, good luck to you :)

2 answers

3


You can use an update panel and place a Trigger or event to refresh the page with each request you want.

Try something like that:

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

I hope it helps.

1

You’ll have to do it using javascript on the client side, rather than using a.

I recommend you use jQuery, to be able to do this, in addition to a very good templates plugin: https://github.com/blueimp/JavaScript-Templates

You will probably need to pick up the element that should be updated, for example a div which contains the list of elements you want to update, and append to it, to insert each new item:

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

Where the variable htmlElemento can be built using a purely string:

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

Or using the template plugin... in case the string option starts to get too complicated.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.