2017-06-27 21 views
1

我是usinf .net框架4.5。我需要製作評分系統,對其進行用戶評分控制。現在,如果我嘗試給予評級行爲不會改變。我也有5星級評級,但如果我的鼠標懸停在任何星它將始終顯示工具提示1.當我看到一個開發者工具在Chrome的錯誤它顯示 enter image description here評級控制在asp.net中不起作用

請幫我解決這個問題。

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ratings.aspx.vb" Inherits="ratings" %> 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> 

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <link rel="stylesheet" type="text/css" href="/fonts/fontawesome/fontawesome.css" /> 
    <style type="text/css"> 
     .star { 
      color: #f00; 
      font-size:2em 
     } 

     .empty { 
      color: #ccc; 
      font-size:2em 
     } 

     .WaitingStar { 
      color: #ed2025; 
      font-size:2em 
     } 

     .FilledStar{ 
      color: #ffcc00; 
      font-size:2em 
     } 
    </style> 

</head> 
<body> 
    <form id="form1" runat="server"> 
     <asp:ToolKitScriptManager ID="sc1" runat="server"></asp:ToolKitScriptManager> 
    <div> 
     <asp:Rating ID="r1" runat="server" EmptyStarCssClass="fa fa-star empty" StarCssClass="fa fa-star empty" WaitingStarCssClass="fa fa-star WaitingStar" FilledStarCssClass="fa fa-star FilledStar" MaxRating="5" CurrentRating="1"></asp:Rating> 
    </div> 
    </form> 
</body> 
</html> 

Global.asax中(默認)

<%@ Application Language="VB" %> 
<%@ Import Namespace="System.Web.Optimization" %> 
<%@ Import Namespace="System.Web.Routing" %> 

    <script runat="server"> 

     Sub Application_Start(sender As Object, e As EventArgs) 
      RouteConfig.RegisterRoutes(RouteTable.Routes) 
      BundleConfig.RegisterBundles(BundleTable.Bundles) 
     End Sub 
    </script> 

Global.asax中(Editted)

<%@ Application Language="VB" %> 
<%@ Import Namespace="System.Web.Optimization" %> 
<%@ Import Namespace="System.Web.Routing" %> 

<script runat="server"> 
    Sub Application_Start(sender As Object, e As EventArgs) 
     'RouteConfig.RegisterRoutes(RouteTable.Routes) 
     BundleConfig.RegisterBundles(BundleTable.Bundles) 
     RegisterRoutes(RouteTable.Routes) 
    End Sub 

    Private Shared Sub RegisterRoutes(routes As RouteCollection) 
     routes.MapPageRoute("index", "index", "~/index.aspx") 
     routes.MapPageRoute("cart", "cart", "~/cart.aspx") 
     routes.MapPageRoute("search", "search/{searhWords}", "~/search.aspx") 
     routes.MapPageRoute("allListing", "{type}", "~/all-listing.aspx") 
     routes.MapPageRoute("allListing2", "all/{type}", "~/all-listing2.aspx") 
     routes.MapPageRoute("priceRangeWise", "price-range/{price}", "~/price-range-wise.aspx") 
     routes.MapPageRoute("skillPage", "skill/{categoryName}/{slug}/{productPageID}", "~/experience-page.aspx") 
    End Sub 
</script> 
+0

我看不出什麼毛病,你已經發布的代碼。你動態添加任何HTML或JavaScript? – GaAd

+0

@GaAd No.沒有額外的腳本或其他任何東西。你也可以看到現場演示foxboxrewards.com/ratings.aspx – SUN

+0

@GaAd你能告訴我在開發者工具中有那些錯誤嗎?我相信這是造成這個問題的原因 – SUN

回答

1

routes.Ignore( 「{}資源個.axd/{* PATHINFO}」) ;

在你的RegisterRoutes功能添加這個 個.axd文件不存在物理

+0

它顯示錯誤IgnoreRoute不是路由集合的成員。 – SUN

+0

你可以在RouteConfig.vb中導入System.Web.Http嗎? – GaAd

+0

我做了,但仍然存在這個問題 – SUN