1

私のコード:

@using Telerik.Web.Mvc.UI;
@using Telerik.Web.UI;

@{
    ViewBag.Title = "Home Page";
}
<script type="text/javascript" src="~/Scripts/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.8.11.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.8.20.min.js"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.9.0.custom.min.css"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.9.0.custom.css"></script>

<script type="text/javascript">
    console.log($)
</script>
@(Html.Telerik().DatePicker()
    .Name("DatePickerDOB")
    .HtmlAttributes(new { style = "width: 140px; " })
)

@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>@ViewBag.Title.</h1>
                <h2>@ViewBag.Message</h2>
            </hgroup>
            <p>
                To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">
                    http://asp.net/mvc</a>. The page features <mark>videos, tutorials,
                        and samples</mark> to help you get the most from ASP.NET MVC. If you have
                any questions about ASP.NET MVC visit <a href="http://forums.asp.net/1146.aspx/1?MVC"
                    title="ASP.NET MVC Forum">our forums</a>.
            </p>
        </div>
    </section>
}
<h3>We suggest the following:</h3>
<ol class="round">
    <li class="one">
        <h5>Getting Started</h5>
        ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
        enables a clean separation of concerns and that gives you full control over markup
        for enjoyable, agile development. ASP.NET MVC includes many features that enable
        fast, TDD-friendly development for creating sophisticated applications that use
        the latest web standards. <a href="http://go.microsoft.com/fwlink/?LinkId=245151">Learn
            more</a></li>
    <li class="two">
        <h5>Add NuGet packages and jump start your coding</h5>
        NuGet makes it easy to install and update free libraries and tools. <a href="http://go.microsoft.com/fwlink/?LinkId=245153">
            Learn more</a></li>
    <li class="three">
        <h5>Find Web Hosting</h5>
        You can easily find a web hosting company that offers the right mix of features
        and price for your applications. <a href="http://go.microsoft.com/fwlink/?LinkId=245157">Learn
            more</a></li>
</ol>

datepicker テキスト フィールドをクリックしたときに DatePicker を表示するためにさらに何をしなければならないのかわかりません。助けてください。ありがとう。

4

1 に答える 1

1

何も問題はありません

@(Html.Telerik().DatePicker()
    .Name("DatePickerDOB")
    .HtmlAttributes(new { style = "width: 140px; " })
)

私のプロジェクトでは問題なく動作します(ただし、テキストボックスではなくアイコンをクリックするとカレンダーが開きますが、現時点では実際にあなたの質問ではないと思います)。

確認してください

@(Html.Telerik().ScriptRegistrar()

が呼び出されています。通常、これは _Layout にありますが、Telerik コントロールを使用してファイルに直接配置できます。

余談ですが(あなたの問題を引き起こしているとは思いませんが、確かに何も助けにはなりません)、これらの行は間違っています:

<script type="text/javascript" src="~/Scripts/jquery-ui-1.9.0.custom.min.css"></script>
<script type="text/javascript" src="~/Scripts/jquery-ui-1.9.0.custom.css"></script>

.css ファイルはスクリプトではありません。これらは次のように参照する必要があります。

<link href="~/Scripts/jquery-ui-1.9.0.custom.min.css" rel="stylesheet" type="text/css"/>

また、このページでは実際に jQuery を使用していないようですので、これらすべてのスクリプトと css ファイルをインポートする必要はおそらくないでしょう。Telerik は独自の jQuery スクリプトを使用します。これがスクリプト Registrar の目的です。

于 2012-10-23T15:57:16.773 に答える