<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog/DialogMaster.Master" AutoEventWireup="true"
    CodeBehind="KnowledgeTypeEdit.aspx.cs" Inherits="OAWeb.Knowledge.KnowledgeTypeEdit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#aspnetForm").validate({
                /*验证规则*/
                rules: {
                    '<%=txtTypeName.UniqueID %>': {
                        required: true
                    }
                },
                messages: {
                    '<%=txtTypeName.UniqueID %>': {
                        required: "请输入类型名称"
                    }
                },
                /*重写错误显示消息方法,以alert方式弹出错误消息*/
                showErrors: function (errorMap, errorList) {
                    var msg = "";
                    $.each(errorList, function (i, v) {
                        msg += (v.message + "\r\n");
                    });
                    if (msg != "") alert(msg);
                },
                /* 失去焦点时不验证 */
                onkeyup: false,
                onfocusout: false
            });
        });
    </script>
    <div class="form" style="width: 600px; padding: 10px;">
        <table cellpadding="0" cellspacing="0" border="0" class="table_form">
            <tr>
                <td class="right">
                    <span class="red">*</span> 类型名称：
                </td>
                <td>
                    <asp:TextBox ID="txtTypeName" runat="server" CssClass="text width200" MaxLength="25"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">
                    父级类型：
                </td>
                <td>
                    <asp:DropDownList ID="ddlParentId" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="right">
                    排序号:
                </td>
                <td>
                    <asp:TextBox ID="txtSortCode" runat="server" CssClass="text width40"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <input id="btnSave" type="button" value=" 保 存 " class="btn_77px" />
                    <input id="btnClose" type="button" value=" 返 回 " onclick="art.dialog.close();return false;"
                        class="btn_77px" />
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            rulesValue = { '<%=txtTypeName.UniqueID %>': { required: true} };
            messagesValue = { '<%=txtTypeName.UniqueID %>': { required: "请输入类型名称"} }
            var form = jQuery.validator.ValidateForm($("#aspnetForm"), rulesValue, messagesValue);
            $("#btnSave").click(function () {
                if (form.form()) {
                    $("#aspnetForm").ajaxSubmit({
                        url: "/Knowledge/KnowledgeTypeEdit.aspx?op=Save&Id=<%=Id %>",
                        success: function (result) {
                            if (result == "ok") {
                                alert("保存成功");
                                CloseReload();
                            } else {
                                alert(result);
                            }
                        }
                    });
                }
                return false;
            })
        });
    </script>
</asp:Content>
