I have a listview that needs to be updated after a comment is added. The submission is handled through jquery, and I'll like to force a refresh after the comment is successfully submitted. Animation would be nice, i was hoping that there is a simple solution. i tried calling a page method to force the rebind but it having to be static has totally lost me as I cannot access the control directly. any help? tia
Asked
Active
Viewed 3,079 times
1
-
Hi, did either of our answers help you? If not, let me know how I can help. – msigman Mar 24 '12 at 17:28
2 Answers
1
Since the listview is a server side control, it will only be possible to rebind though a postback. One way I've done this in the past is to put a hidden "refresh" button on the page
<asp:button runat="server" id="btnRefresh" onclick="ReBindListView" style="display:none;" />
And then use javascript to cause the postback
function refresh() {
__doPostBack('<%= btnRefresh.ClientID %>', '');
}
On the server side of the btnRefresh click you can then rebind your listview

Ulhas Tuscano
- 5,502
- 14
- 58
- 89

Dave D
- 691
- 5
- 11
-
-
@msigman the javascript function "refresh" is actually causing a postback and calling the server side RebindListView procedure. – Dave D Mar 22 '12 at 11:51
-
Your solution is clever! On the PostBack subject point I'm not actually sure. Is it doing a .NET PostBack or is it doing a jQuery AJAX call to the server to get the data? You are probably right it does a PostBack internally. But at the very least using the predefined JavaScript `rebind()` method is a little simpler because it doesn't require creating the hidden button. – msigman Mar 22 '12 at 15:55
-
ah, I missed that this was a telerik question. My solution was for the asp ListView. – Dave D Mar 22 '12 at 16:41
0
You can rebind your RadListView anytime necessary to update it with the new comments. Here's an example:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function RefreshRadListView() {
var listView = $find("<%= RadListView1.ClientID %>");
listView.rebind();
}
</script>
</telerik:RadCodeBlock>
http://www.telerik.com/help/aspnet-ajax/listview-rebind.html

msigman
- 4,474
- 2
- 20
- 32