<form id="form1" runat="server"> <asp:ScriptManager ID="sm" runat="server" /> <div> <div class="demoarea"> <div class="demoheading">Rating Demonstration </div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div style="float: left; width:230;">How much do you like ASP.NET AJAX ?</div> <cc1:Rating ID="LikeRating" runat="server" CurrentRating="3" MaxRating="5" StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar" FilledStarCssClass="filledRatingStar" EmptyStarCssClass="emptyRatingStar" OnChanged="LikeRating_Changed" style="float: left;"> </cc1:Rating> <br /> <div style="clear:left;"> <br /> <asp:Button ID="ButtonSubmit" runat="server" Text="Submit" onclick="ButtonSubmit_Click" /><br /><br /> <asp:Label ID="LabelResponse" runat="server" Text="[ No response provioded yet.]"></asp:Label> </div> </ContentTemplate> </asp:UpdatePanel> </div> </div> </form>
protected void LikeRating_Changed(object sender, AjaxControlToolkit.RatingEventArgs e) { e.CallbackResult = "Upate done. Value = " + e.Value + " Tag = " + e.Tag; } protected void ButtonSubmit_Click(object sender, EventArgs e) { string howMuch = "[unknown]"; switch (LikeRating.CurrentRating) { case 1: howMuch = "a bit."; break; case 2: howMuch = "some."; break; case 3: howMuch = "a fair bit."; break; case 4: howMuch = "a lot."; break; case 5: howMuch = "more than any thing."; break; } LabelResponse.Text = "You like ASP.NET AJAX <b>" + howMuch + "</b>."; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)