将Dojo Toolkit(Dijit)主题应用于ASP.NET页面

时间:2010-05-06 22:31:20

标签: asp.net master-pages dojo

在下面的代码中,我尝试将Dijit主题应用于我的.aspx页面中的控件。然而,控制仍然保持其正常的,未经训练的外观。

有人知道为什么吗?

母版页:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="WebJournalEntryClient.Main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>My Web Application</title>
    <link rel="stylesheet" href="dojoroot/dijit/themes/tundra/tundra.css" />
     <script type="text/javascript" src="dojoroot/dojo/dojo.js"/>
     <script type="text/javascript">
         dojo.require("dijit.form.Button");
         dojo.require("dijit.form.TextBox");
         dojo.require("dijit.form.ComboBox");
     </script>
</head>
<body class = "tundra">
    <form id="form1" runat="server">
    <div>
        <div>
            This is potentially space for a header bar.
        </div>
        <table>
        <tr>
            <td>
                Maybe <br /> a <br /> Side <br /> bar.
            </td>
            <td>
                <asp:ContentPlaceHolder ID="CenterPlaceHolder" runat="server"/>
            </td>
        </tr>
        </table>
        <div>
            This is potentially space for a footer bar.
        </div>
    </div>
    </form>
</body>
</html>

内容页面:

<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"       CodeBehind="LogIn.aspx.cs" Inherits="WebJournalEntryClient.LogIn" %>
<asp:Content ID="Content" ContentPlaceHolderID="CenterPlaceHolder" runat="server">
    <div>
    User ID: <asp:TextBox ID = "UserName" dojoType="dijit.form.TextBox" runat="server" /><br />
    Password: <asp:TextBox ID = "PassWord" dojoType="dijit.form.TextBox" runat="server" /><br />
    <asp:Button ID="LogInButton" Text="Log In" dojoType="dijit.form.Button" runat="server" />
    </div>
</asp:Content>

3 个答案:

答案 0 :(得分:2)

您需要将djConfig="parseOnLoad: true"添加到脚本标记中。

<script type="text/javascript" src="dojoroot/dojo/dojo.js" djConfig="parseOnLoad: true"/>

dojo.parser.parse();

答案 1 :(得分:0)

可能是路径错了。使用Firebug查看它是否正在读取任何CSS。

答案 2 :(得分:0)

我不确定ASP.net在您的网页上做了什么。 但是无论如何你可以用萤火虫仔细检查你的身体在浏览器输出中有“tundra”类?我假设CSS正常进行(:正如您在上面的评论中所提到的)