我正试图从ajax:Rating
内的asp:Repeater
获取CurrentRating,但它给了我0。
我在asp.net中的代码:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<ajax:Rating ID="Rating1" AutoPostBack="true" runat="server" StarCssClass="Star"
WaitingStarCssClass="WaitingStar" EmptyStarCssClass="Star"
FilledStarCssClass="FilledStar" OnChanged="Save_Location"></ajax:Rating>
</ItemTemplate>
</asp:Repeater>
在C#背后:
foreach (RepeaterItem rptItem in Repeater1.Items)
{
Rating ratingControl;
int rate;
ratingControl = (Rating)(rptItem.FindControl("Rating1"));
rate = ratingControl.CurrentRating;
if (rate != 0)
{
//do something
break;
}
}