作成日: 2015/06/09 最終更新日: 2015/09/16
文書種別
不具合
状況
修正済み
詳細
エリア内のビューにC1コンポーネントを配置した場合、実行時に下記のJavaScript 実行時エラーが発生します。
■エラーメッセージ
0x800a1391 - JavaScript 実行時エラー: 'c1' は定義されていません。
◎サンプルコード(エリア内、cshtml)
【再現方法】
1.サンプルを実行し、エリア内のビューを表示します。
結果:JavaScript 実行時エラーが発生します
■エラーメッセージ
0x800a1391 - JavaScript 実行時エラー: 'c1' は定義されていません。
◎サンプルコード(エリア内、cshtml)
@(Html.C1().LinearGauge()
.Value(35)
.Min(0).Max(100)
)
.Value(35)
.Min(0).Max(100)
)
【再現方法】
1.サンプルを実行し、エリア内のビューを表示します。
結果:JavaScript 実行時エラーが発生します
回避方法
この問題はバージョン4.0.20152.31で修正されました。
修正版の適用方法については、アップデートの方法を参照してください。
修正版を適用しない場合の回避方法は次のとおりです。
下記コードのようにAreaRegistrationクラスにC1コンポーネントへのルートを追加します。
◎サンプルコード(VB)(Areas/<エリア名>/<エリア名>AreaRegistrationクラス)
◎サンプルコード(C#)(Areas/<エリア名>/<エリア名>AreaRegistrationクラス)
※上記のサンプルコードはエリア名が"Area1"である場合のコードです。
修正版の適用方法については、アップデートの方法を参照してください。
修正版を適用しない場合の回避方法は次のとおりです。
下記コードのようにAreaRegistrationクラスにC1コンポーネントへのルートを追加します。
◎サンプルコード(VB)(Areas/<エリア名>/<エリア名>AreaRegistrationクラス)
Public Overrides Sub RegisterArea(context As AreaRegistrationContext)
' 新しいルートを追加 --------------------
Dim route = New Route("{controller}/{action}/{id}", New RouteValueDictionary(New With { _
Key .action = "Index", _
Key .id = UrlParameter.[Optional] _
}), New RouteValueDictionary(New With { _
Key .controller = "C1WebMvc" _
}), New RouteValueDictionary(New With { _
Key .area = "Area1" _
}), New MvcRouteHandler())
context.Routes.Add(route)
'----------------------------------------
context.MapRoute("Area1_default", "Area1/{controller}/{action}/{id}", New With { _
Key .action = "Index", _
Key .id = UrlParameter.[Optional] _
})
End Sub
' 新しいルートを追加 --------------------
Dim route = New Route("{controller}/{action}/{id}", New RouteValueDictionary(New With { _
Key .action = "Index", _
Key .id = UrlParameter.[Optional] _
}), New RouteValueDictionary(New With { _
Key .controller = "C1WebMvc" _
}), New RouteValueDictionary(New With { _
Key .area = "Area1" _
}), New MvcRouteHandler())
context.Routes.Add(route)
'----------------------------------------
context.MapRoute("Area1_default", "Area1/{controller}/{action}/{id}", New With { _
Key .action = "Index", _
Key .id = UrlParameter.[Optional] _
})
End Sub
◎サンプルコード(C#)(Areas/<エリア名>/<エリア名>AreaRegistrationクラス)
public override void RegisterArea(AreaRegistrationContext context)
{
// 新しいルートを追加 --------------------
var route = new Route("{controller}/{action}/{id}",
new RouteValueDictionary(new { action = "Index", id = UrlParameter.Optional }),
new RouteValueDictionary(new { controller = "C1WebMvc" }),
new RouteValueDictionary(new { area = "Area1" }),
new MvcRouteHandler());
context.Routes.Add(route);
//----------------------------------------
context.MapRoute(
"Area1_default",
"Area1/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
{
// 新しいルートを追加 --------------------
var route = new Route("{controller}/{action}/{id}",
new RouteValueDictionary(new { action = "Index", id = UrlParameter.Optional }),
new RouteValueDictionary(new { controller = "C1WebMvc" }),
new RouteValueDictionary(new { area = "Area1" }),
new MvcRouteHandler());
context.Routes.Add(route);
//----------------------------------------
context.MapRoute(
"Area1_default",
"Area1/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
※上記のサンプルコードはエリア名が"Area1"である場合のコードです。
旧文書番号
81343