or
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load'Get ratings and display on page Dim tbRatings As DataTable = New IMCSelect().getRatings(-1, 8, Request.QueryString("ID"), 1, 0, Application("logMaterials")).Tables(0) Dim Sum As Single For Each dr As DataRow In tbRatings.Rows If dr.RowState <> DataRowState.Deleted Then Sum += Convert.ToInt32(dr("Rating")) End If Next Dim iAvgRating As Single = 0 If tbRatings.Rows.Count <> 0 Then iAvgRating = Math.Round(Sum / tbRatings.Rows.Count, 2) lblAvgRating.Text = iAvgRating End If Dim tbComments As DataTable = New IMCSelect().getRatings(-1, 8, Request.QueryString("ID"), 1, 0, Application("logPublications")).Tables(0) Dim comments = From r In tbComments.AsEnumerable Where r.Field(Of String)("RatingComments") <> "" Select r If comments.Count() <> 0 Then tbComments = comments.CopyToDataTable() Else tbComments.Rows.Clear() End If hlComments.Text = "View comments" hlComments.NavigateUrl = "Javascript:ViewComments(" & Request.QueryString("ID") & ");" If tbComments.Rows.Count() <> 0 Then divComments.Style.Add("display", "block;") Else divComments.Style.Add("display", "none;") End IfEnd Sub Private Property Rating() As Dictionary(Of String, Decimal) Get Dim varRating As Dictionary(Of String, Decimal) = DirectCast(ViewState("Rating"), Dictionary(Of String, Decimal)) If [Object].Equals(varRating, Nothing) Then varRating = New Dictionary(Of String, Decimal)() varRating("sum") = 0 varRating("counter") = 0 End If Return varRating End Get Set(ByVal value As Dictionary(Of String, Decimal)) ViewState("Rating") = value End Set End Property Protected Sub btnPostComment_Click(ByVal sender As Object, ByVal e As EventArgs) Dim iRatingID As Integer iRatingID = New IMCInsert().addRating(RadRating1.Value, txtComments.Text, 8, Request.QueryString("ID"), Session("RBPOnline_UserID"), Application("logMaterials")) txtComments.Text = "" 'Close tooltip Dim str As String = "CloseToolTip1();" ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(Page), "closeTooltip", str, True) End Sub Protected Sub RadRating1_Rate(ByVal sender As Object, ByVal e As EventArgs) Dim currentRating As Dictionary(Of String, Decimal) = Rating currentRating("sum") = currentRating("sum") + RadRating1.Value currentRating("counter") = currentRating("counter") + 1 Rating = currentRating Dim averageRating As Decimal = Math.Round(currentRating("sum") / currentRating("counter"), 1) End Sub<form id="form1" runat="server"> <script type="text/javascript"> function onNavigate(isMoveNext) { var tabs = $find('<%= rtbstMain.ClientID %>'); var totalNumOfTabs = tabs.get_tabs().get_count(); if(totalNumOfTabs > 0) { var newTabIndex; var currentTabIndex = tabs.get_selectedIndex(); if(isMoveNext){ if(currentTabIndex + 1 == totalNumOfTabs) { newTabIndex = 0; } else { newTabIndex = currentTabIndex + 1; } } else{ if(currentTabIndex - 1 < 0) { newTabIndex=totalNumOfTabs - 1else { newTabIndex=currentTabIndex - 1tabs.set_selectedIndex(newTabIndexscript> <asp:ScriptManager ID="smPageScriptManager" runat="server" /> <telerik:RadTabStrip ID="rtbstMain" runat="server" MultiPageID="RadMultiPage1" SelectedIndex="0"> <Tabs> <telerik:RadTab runat="server" Text="Root RadTab1" Selected="True"> </telerik:RadTab> <telerik:RadTab runat="server" Text="Root RadTab2"> </telerik:RadTab> <telerik:RadTab runat="server" Text="Root RadTab3"> </telerik:RadTab> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0"> <telerik:RadPageView ID="RadPageView1" runat="server"> RadPageView1</telerik:RadPageView> <telerik:RadPageView ID="RadPageView2" runat="server"> RadPageView2</telerik:RadPageView> <telerik:RadPageView ID="RadPageView3" runat="server"> RadPageView3</telerik:RadPageView> </telerik:RadMultiPage> <asp:Button ID="Button1" runat="server" Text="Prev" OnClientClick="onNavigate(false); return false;" /> <asp:Button ID="Button2" runat="server" Text="Next" OnClientClick="onNavigate(true); return false;" /></form>