<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Admin/AdminMain.Master" Inherits="System.Web.Mvc.ViewPage<MvcEnterprise.Models.DataSet1+TemplateRow>" %>

<asp:Content ID="Content0" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Admin.js" type="text/javascript"></script>
    <%Html.EnableClientValidation(); %>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    编辑内容
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<script type="text/javascript">
		function setKey(obj) {
			if ((event.ctrlKey && window.event.keyCode == 13)) {
				obj.readOnly = !obj.readOnly;
			}
		}
		function startDesign() {
			if (!$.browser.msie) {
				alert("此功能只支持IE浏览器。");
				return false;
			}
			form0.attributes["action"].value='<%=Url.Action("TemplateDesign")%>?_=' + Math.random();
			$("#form0").attr("target", "_blank").submit();
		}
		function saveCode(){
			form0.attributes["action"].value = '<%=Url.Action("TemplateEdit")%>';
			$("#form0").attr("target", "_self");
		}
	</script>
    <div>
        <%= Html.ActionLink("返回列表","TemplateList") %></div>
    <hr />
    <% using (Html.BeginForm()) {%>
    <div style="display:none">
        <%--模板类型--%>
        <span class="editor-label"><%= Html.LabelFor(model => model.type) %>：</span>
        <span class="editor-field"><%= Html.TextBoxFor(model => model.type) %> <%= Html.DisplayToolTipFor(model => model.type) %> <%= Html.ValidationMessageFor(model => model.type) %></span>
    </div>
    <div>
        <%----%>
        <%= Html.HiddenFor(model=>model.ID) %>
    </div>
    <div>
        <%--文件名--%>
        <span class="editor-label"><%= Html.LabelFor(model => model.filename) %>：</span>
        <span class="editor-field"><%= Html.TextBoxFor(model => model.filename) %> <%= Html.DisplayToolTipFor(model => model.filename) %> <%= Html.ValidationMessageFor(model => model.filename) %></span>
    </div>
    <div>
        <%--文件内容--%>
        <%= Html.TextAreaFor(model => model.content, new { style = "width:100%;height:300px" })%>
        <%= Html.ValidationMessageFor(model => model.content) %>
    </div>
    <div>
        <%--备注说明--%>
        <span class="editor-label"><%= Html.LabelFor(model => model.memo) %>：</span>
        <span class="editor-field"><%= Html.TextBoxFor(model => model.memo) %> <%= Html.DisplayToolTipFor(model => model.memo) %> <%= Html.ValidationMessageFor(model => model.memo) %></span>
    </div>
    <p>
		<%= Html.HiddenFor(m=>m.controller) %> <%= Html.ValidationMessageFor(m=>m.controller) %>
		<%= Html.HiddenFor(m=>m.action) %> <%= Html.ValidationMessageFor(m=>m.action) %>
		<input type="button" onclick="startDesign()" value="可视设计" />
		<input type="submit" onclick="saveCode()" value="保 存" />
		<input type="reset" onclick="return confirm('重置功能将会恢复修改前的状态，确认吗？')" value="重 置" />
	</p>
    <% } %>
</asp:Content>