我在Repeater中有Ajax评级控制。当我不使用updatepanel时,WaitingStarCssClass不起作用,当我将评级控制放入updatepanel时,评级控制不起作用。 我的代码示例:
<asp:Repeater ID="CommunitiesListRepeater" runat="server"
OnItemCommand="_CommunitiesList_ItemCommand"
onitemdatabound="CommunitiesListRepeater_ItemDataBound">
<HeaderTemplate>
<table border="0" style="border-collapse:collapse;">
</HeaderTemplate>
<ItemTemplate>
<tr >
<td style="border-top:1px solid gray;border-right:1px solid gray;padding-top:10px;" valign="top">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<ajaxToolkit:Rating ID="Rating1" runat="server"
CurrentRating='<%# GetCommunityUserRating(Eval("Reference").ToString())%>' AutoPostBack="true"
MaxRating="5" OnChanged="Rating_Changed" Tag='<%# Eval("Reference").ToString()%>'
CssClass="ratingStar"
StarCssClass="ratingItem"
WaitingStarCssClass="Saved"
FilledStarCssClass="Filled"
EmptyStarCssClass="Empty"
style="float: left;" />
<asp:Label ID="CommunityRating" runat="server" Text='<%# WriteAvgRating(Eval("UserRating"), Eval("Reference").ToString()) %>' Font-Bold="False" Font-Size="X-Small"></asp:Label>
</ContentTemplate></asp:UpdatePanel>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
代码隐藏:
protected void Rating_Changed(object sender, RatingEventArgs e)
{
string reference = ((AjaxControlToolkit.Rating)sender).Tag;
int rating = Convert.ToInt32(e.Value);
...
FillRepeater(); // reload data in repeater
}
如何在Repeater中正确使用评级控制?