单击c#中的评级星时避免页面刷新 [英] avoid page refreshing when click on the rating star in c#

查看:96
本文介绍了单击c#中的评级星时避免页面刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当点击评级星时页面变为refresh.how以避免刷新page.iam也使用此代码中的更新面板。使用ajax的星形。

解决方案

< blockquote>使用更新面板控件。它是Ajax提供的非常好的功能。

从这里学习它:

understanding-asp-net-ajax-updatepanel-triggers [ ^ ]


Add这个

protected void Page_Load(object sender,EventArgs e)

{

Rating1.Attributes.Add(" onclick"," return) false;");

}


您可以使用Ajax取消回发。



通过以下方式获取实例



var obj = Sys.WebForms.PageRequestManager.getInstance()



然后检查这是否是异步回发并检查触发回发的元素ID你可以中止帖子。



obj.abortPostBack();



参考 - http://msdn.microsoft.com/en-us/library/bb398789(v= vs.100).aspx



如果能解决您的问题,请提供反馈。


when click on the rating star the page become refresh.how to avoide refresh the page.iam also using update panel in this code.rating star using ajax.

解决方案

Use Update panel control. its very nice feature provided by Ajax.
learn it from here:
understanding-asp-net-ajax-updatepanel-triggers[^]


Add this
protected void Page_Load(object sender, EventArgs e)
{
Rating1.Attributes.Add("onclick", "return false;");
}


you can cancel post back using the Ajax.

get the instance by following

var obj=Sys.WebForms.PageRequestManager.getInstance()

then check if this is Async postback and check with the element id that triggers the post back you can abort the post back.

obj.abortPostBack();

Refer - http://msdn.microsoft.com/en-us/library/bb398789(v=vs.100).aspx

Please provide feedback if this solves your issue.


这篇关于单击c#中的评级星时避免页面刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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