0

我在我的 aspx 页面中使用 kendo ui Mobile ModalView 但我无法获得所需的输出。单击按钮时它显示相同的页面。我是剑道ui的新手。请任何人帮助我。请参考 kendo ui 移动模式视图并建议我如何在我的项目中使用它。

My code is
<head runat="server">
<title>Untitled Page</title>
<link href="CSS/kendo.common.css" rel="stylesheet" type="text/css" />
<%--<link href="CSS/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />--%>
<link href="CSS/kendo.default.css" rel="stylesheet" type="text/css" />
<link href="CSS/kendo.mobile.all.css" rel="stylesheet" type="text/css" />
<link href="CSS/Example.css" rel="stylesheet" type="text/css" />

<script src="Js/jquery1.7.1.min.js" type="text/javascript"></script>

<script src="CSS/kendo.min.js" type="text/javascript"></script>
 <script type="text/javascript">
function closeModalViewLogin() {
    $("#modalview-login").data("kendoModalView").open();
}
</script>


<script type="text/javascript">
var app = new kendo.mobile.Application(document.body);
</script>
</head>

 <body>


<form id="form1" runat="server">
<div data-role="view" id="modalview-camera" data-title="HTML5 Camera">
<img src="../../content/mobile/modalview/lens.png" class="camera-image" /><br />
<a data-role="button" data-rel="modalview" href="#modalview-login" id="modalview-open-  
button">Login</a>
</div>


<div data-role="modalview" id="modalview-login" style="width: 95%; height: 80%;">
<div data-role="header">
    <div data-role="navbar">
        <span>Login</span>
        <a data-click="closeModalViewLogin" data-role="button" data- 
align="right">Cancel</a>
    </div>
</div>

<ul data-role="listview" data-style="inset">
    <li><label for="username">Username:</label> <input type="text" id="username" />  


</li>
    <li><label for="password">Password:</label> <input type="password" id="password" />  
</li>
</ul>
<a data-click="closeModalViewLogin" id="modalview-login-button" type="button" data-  
role="button">Login</a>
<a data-click="closeModalViewLogin" id="modalview-reg-button" type="button" data-  
role="button">Register</a>
</div>
</form>
</body>
4

3 回答 3

0

此外,您可以在表单而不是正文上初始化移动应用程序,因为视图应该是应用程序元素的直接后代。

于 2012-11-07T05:56:28.443 回答
0

根据要求更改代码

<html>
<head runat="server">
    <title>Model view sample</title>
    <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
    <script src="http://cdn.kendostatic.com/2012.2.710/js/kendo.mobile.min.js"></script>
    <link href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.mobile.all.min.css" rel="stylesheet" />

    <script type="text/javascript">
        function closeModalViewLogin() {
            $("#modalview-login").data("kendoModalView").open();
        }
    </script>
</head>

<body>

    <div data-role="view" id="modalview-camera" data-title="HTML5 Camera">
        <a data-role="button" data-rel="modalview" href="#modalview-login" id="modalview-open-button">Login</a>

        <div data-role="modalview" id="modalview-login" style="width: 95%; height: 80%;">
            <div data-role="header">
                <div data-role="navbar">
                    <span>Login</span>
                    <a data-click="closeModalViewLogin" data-role="button" data-align="right">Cancel</a>
                </div>
            </div>

            <ul data-role="listview" data-style="inset">
                <li>
                    <label for="username">Username:</label>
                    <input type="text" id="username" />


                </li>
                <li>
                    <label for="password">Password:</label>
                    <input type="password" id="password" />
                </li>
            </ul>
            <a data-click="closeModalViewLogin" id="modalview-login-button" data-role="button">Login</a>
            <a data-click="closeModalViewLogin" id="modalview-reg-button" data-role="button">Register</a>
        </div>
    </div>


    <script type="text/javascript">
        var app = new kendo.mobile.Application(document.body);
    </script>
</body>
</html>

这工作正常。

笔记

1:模型视图应始终在内部使用<div data-role="view" ...>...</div>

2:文档准备好后初始化kendo移动应用程序(即var app = new kendo.mobile.Application(document.body))

于 2013-03-20T11:13:11.800 回答
0

如果您查看您用作起点的代码示例@ http ://demos.kendoui.c​​om/mobile/modalview/index.html - 您会发现调用 Kendo 框架的脚本标签的位置位于在正文标记的底部,如果您将它们放在正文上方,如示例代码中所示,则在该阶段没有任何内容可以执行脚本。您需要将它们移动到正确的位置。或者使用 jQuery 就绪命令并从那里调用 Kendo 脚本。

 $(document).ready(function () {
  $("p").text("The DOM is now loaded and can be manipulated.");
});   
于 2012-11-06T09:29:35.653 回答