0

私はテレリックと MVC を初めて使用します。テレリックのページ読み込み時にモデル フォーム (ユーザーがサブスクライブできるようにする) をポップアップ表示しようとしています。これは Index.cshtml のコードで、テスト コード "hello world" は呼び出されていません。

@model Subscriber
 @{  Html.Telerik().Window()
    .Name("Window")
    .Title("Submit feedback")
    .Content(@<text>
        @using (Html.BeginForm("popupform", "window", FormMethod.Post, new { id = "feedback-form" }))
        {
            <p class="note">Subscribe<strong>not</strong> be saved.</p>

            @Html.LabelFor(model => model.Email)
            @Html.TextBoxFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)

            <div class="form-actions">
                <button type="submit" class="t-button t-state-default">Submit feedback!</button>
            </div>
        }
        </text>)
    .Width(400)
    .Draggable(true)
    .Modal(true)
    .Visible(false)
    .Render();
 } 

 @{
    ViewBag.Title = "Home Page";
 }
@{
Html.Telerik().ScriptRegistrar().OnDocumentReady(
@<text>
    // put some javascript goodness in here
   alert('hello world');
   $('#Window').data('tWindow').center().open();
</text>);
}
4

1 に答える 1

0

これを試して:

....
@{
    Html.Telerik().ScriptRegistrar().OnDocumentReady(@"OnInit();");
}
<script type="text/javascript">
function OnInit() {
     // put some javascript goodness in here
     alert('hello world');
     $('#Window').data('tWindow').center().open();  
}

あなたの問題はタグにあると思いますが、よくわかりません。コードの前は、いずれにしても機能する必要があります。

于 2012-10-17T09:53:42.130 に答える