2012-11-06 89 views
0

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

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> 

回答

0

如果你看一下你作为出发点@http://demos.kendoui.com/mobile/modalview/index.html代码的例子 - 你会发现脚本标记的那个位置,以剑道框架调用位于body标签的底部,如果你将它们放置在代码示例中所示的身体上方,在那个阶段没有任何东西可以执行脚本。您需要将它们移动到正确的位置。或者使用jQuery ready命令并从那里调用Kendo脚本。

$(document).ready(function() { 
    $("p").text("The DOM is now loaded and can be manipulated."); 
}); 
0

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

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内使用:Intialize剑术移动应用程序文档后准备 (即无功应用=新kendo.mobile.Application(文件。 body))

+0

根据演示,你错了关于你的第一个音符,模态视图不在

http://demos.kendoui.c​​om/mobile/modalview/index.html – Dean