从c#刷新转发器不起作用 [英] refresh repeater from c# not working

查看:65
本文介绍了从c#刷新转发器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友您好我搜索了很多但我希望我能在这里找到结果



这里是我的代码



i有n-repeater我创建了博客,但我想在全球刷新那个转发器



假设在印度有一个人添加了评论并且在差异位置内博客应该自动刷新





  case    commentreply
if < /(>((TextBox)e.Item.FindControl( txtreply))。文本。 ToString()!=
{
property.tag = < span class =code-digit> 17
;
property.favour = 0 ;
property.user_id = Convert.ToInt32(会话[ user_id]。ToString() );
property.blog_id = Convert.ToInt32(ViewState [ blog_id]。ToString() );
property.blog_content =((TextBox)e.Item.FindControl( txtreply) ).Text.ToString();
property.comment_id = Convert.ToInt32(((HiddenField)e.Item.FindControl( comment_id)).Value);
property.active = true ;
bal.blog(property);

}
bindcomment();
break ;







这里是绑定评论

 rptcomment.datsource = dt; 
rptcomment.DataBind();





一切正常,但我只想要这个额外的任务...... .repeater不会全局刷新

解决方案

这是服务器端代码,因此只有当浏览器返回页面或再次获取刷新页面时,转发器才会刷新。

对于要自动刷新的数据,您需要在定义的时间间隔内轮询服务器以获取新数据。您可以使用jQuery和AJAX轻松完成。或者,当您需要实时更新(例如聊天,Facebook通知)时应该使用的另一个选项是使用推送技术。 SignalR [ ^ ]是一个非常优雅地帮助实现这一目标的库。检查链接,并确定这是否是你需要的。



希望有所帮助!


refreshing-a-repeater-control-in-an-updatepanel-with-asp-net [ ^ ]



refresh-repeater-control-aspnet-100009.aspx [ ^ ]



虽然我不确定但仍然检查链接..希望它会帮助..

Hello friends i have searched a lot but i wish i can find result here

here is the my code

i have n-repeater i have created blog but i want to refresh that repeater globally

suppose in india one person have added comment and within diff location that blog should be refreshed automatically


case "commentreply":
                if (((TextBox)e.Item.FindControl("txtreply")).Text.ToString() != "")
                {
                    property.tag = 17;
                    property.favour = 0;
                    property.user_id = Convert.ToInt32(Session["user_id"].ToString());
                    property.blog_id = Convert.ToInt32(ViewState["blog_id"].ToString());
                    property.blog_content = ((TextBox)e.Item.FindControl("txtreply")).Text.ToString();
                    property.comment_id = Convert.ToInt32(((HiddenField)e.Item.FindControl("comment_id")).Value);
                    property.active = true;
                    bal.blog(property);

                }
                bindcomment();
                break;




and here is bind comment

rptcomment.datsource=dt;
rptcomment.DataBind();



all working fine but i just want this additional task to do......repeater does not refresh globally

解决方案

This is a server side code and thus the repeater will only refresh when the browser pots back the page or gets the refreshed page again.
For the data to refresh automatically, you either need to poll the server in a defined interval to get the new data. You can do that easily using jQuery and AJAX. Or the other option, which should be used when you need real time updates (example chats, facebook notification), is to use push technology. SignalR[^] is a library which helps achieve this very elegantly. Checkout the link and and decide if that's what you need.

Hope that helps!


refreshing-a-repeater-control-in-an-updatepanel-with-asp-net[^]

refreshing-repeater-control-aspnet-100009.aspx[^]

Although i am not sure but still check the links..hope it will help..


这篇关于从c#刷新转发器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆