Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 12-Dec-12 20:02pm
v2

Use Update panel control. its very nice feature provided by Ajax.
learn it from here:
understanding-asp-net-ajax-updatepanel-triggers[^]
 
Share this answer
 
Comments
arya.anu 13-Dec-12 2:03am    
update panel using in my code.but the page become refresh.
choudhary.sumit 13-Dec-12 2:07am    
put your rating star control inside the update panel not the whole page. post your design code here so that i can identify the issue.
arya.anu 13-Dec-12 2:09am    
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<contenttemplate>
<div class="NewRating">
 <span style="float: left; margin-bottom: 10px; width: 130px; margin-right: 10px">Clean:</span>
<ajaxToolkit:Rating ID="Rating1" runat="server" CssClass="ratingStar" CurrentRating="1"
EmptyStarCssClass="Empty" FilledStarCssClass="Filled" MaxRating="10" StarCssClass="ratingItem"
Style="float: left; margin: 0px; position: static; margin-left: 50px;" WaitingStarCssClass="Saved"
Width="131px" AutoPostBack="false" önChanged="Rating1_Changed">

<div style="clear: both">
</div>
</div>

choudhary.sumit 13-Dec-12 2:15am    
it seems ok so far.post "Rating1_Changed" event code.
arya.anu 13-Dec-12 2:16am    
protected void Rating1_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
{
Evaluate_Rating1(int.Parse(e.Value));
}
Add this
protected void Page_Load(object sender, EventArgs e)
{
Rating1.Attributes.Add("onclick", "return false;");
}
 
Share this answer
 
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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900