<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edit.aspx.cs"
    Inherits="Aspx1.User.Edit" ValidateRequest="false" %>
<!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 id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>12ym源码交易网</title>
    <link rel="stylesheet" href="/themes/default/style.css" type="text/css" media="screen,projection" />
    <script src="/js/Common.js" type="text/javascript"></script>
</head>
<body> <asp:Literal ID="head" runat="server"></asp:Literal>
    <form id="form1" runat="server">
    <div class="ym_h_left">
        <asp:Literal ID="left" runat="server"></asp:Literal>
    </div>
    <div class="ym_h_right">
    <div class="panel ym_h_rt ym_line">
        <ul class="ym_head">
            <li class="title">修改信息</li>
        </ul>
        <table class="tableBorder" border="0" cellpadding="0" cellspacing="1" style="text-align: left;">
            <tr>
                <td>
                    商品名称：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:TextBox ID="txtTitle" runat="server" CssClass="ym12_input" Width="394px"></asp:TextBox>
                    *
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txttitle"
                        ErrorMessage="商品名称怎么可能为空！"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    所属类别：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:DropDownList ID="ddlCategory" runat="server" DataSourceID="ObjectDataSource1"
                        DataTextField="CategoryName" DataValueField="CategoryID">
                    </asp:DropDownList>
                    *
                </td>
            </tr>
            <tr>
                <td>
                    商品属性：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:RadioButtonList ID="rblIsAsk" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Text=" 出售 " Selected="True"></asp:ListItem>
                        <asp:ListItem Value="1" Text=" 求购 "></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td>
                    演示地址：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:TextBox ID="txtURL" runat="server" Width="250px">http://</asp:TextBox>
                    *
                </td>
            </tr>
            <tr>
                <td>
                    价格：
                </td>
                <td  class="td1" style="padding-left: 10px;">
                    <asp:TextBox ID="txtPrice" runat="server" Width="61px" onKeyUp="isNumber(this);"
                        Text="1"></asp:TextBox>
                    &nbsp;元 *
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtprice"
                        ErrorMessage="不填写价格，准备白送？"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    联系QQ：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:TextBox ID="txtQQ" runat="server" Width="250px" onKeyUp="isNumber(this);"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    邮箱：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:TextBox ID="txtMail" runat="server" Width="250px"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="邮箱格式不正确！"
                        ControlToValidate="txtMail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                    联系电话：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:TextBox ID="txtTel" runat="server" Width="250px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    源码截图：
                </td>
                <td class="td1" style="padding-left: 10px">
                   
                    <asp:TextBox ID="txtImgURL" runat="server" ReadOnly="true" Width="444px" style="display:none;"></asp:TextBox>
                    <asp:TextBox ID="txtImgDesc" runat="server" ReadOnly="true" Width="444px" Style="display: none;"></asp:TextBox><br />
                   
                    注：截图只支持：jpg,gif,png,bmp四种格式）
                    <div id="myFile">
                        <div id="attach1">
                            <span id="attach_s1"></span>
                            <input type="file" name="file_1" id="file_1" onchange="attach_change();" />描述:<input
                                type="text" name="filedesc_1" id="filedesc_1" /></div>
                    </div>

                    <script type="text/javascript">
                        var aid = 0;
                        var id = 1;
                        function attach_change() {
                            if (aid > 5) { alert('最多只能上传5个附件！'); return; }
                            var extensions = 'jpg,gif,png,bmp';
                            var obj = $('file_' + id);
                            var path = obj.value;
                            var ext = path.lastIndexOf('.') == -1 ? '' : path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase();
                            var re = new RegExp("(^|\\s|,)" + ext + "($|\\s|,)", "ig");
                            if (path == '') { return; }
                            if (extensions != '' && (re.exec(extensions) == null || ext == '')) {
                                obj.value = "";
                                alert('对不起，不支持上传此类扩展名的附件。');
                                return;
                            }
                            var newNode = $("attach" + id).cloneNode(true);

                            obj.style.display = "none";
                            obj = document.createElement("a");
                            obj.href = "javascript:attach_del(" + id + ")";
                            obj.innerHTML = "[删除]";
                            $("attach" + id).appendChild(obj);
                            $("attach_s" + id).innerHTML = "源码截图：" + path.substr(path.lastIndexOf("\\") + 1);

                            id++;
                            newNode.id = "attach" + id;
                            newNode.childNodes[0].id = "attach_s" + id
                            newNode.childNodes[1].name = "file_" + id;
                            newNode.childNodes[1].id = "file_" + id;
                            newNode.lastChild.name = "filedesc_" + id;

                            $('myFile').appendChild(newNode);
                            aid++;
                        }
                        function attach_del(id) {
                            var theNode = $('attach' + id);
                            $('myFile').removeChild(theNode);
                            aid--;
                        }
                    </script>
<br/>
                </td>
            </tr>
            <tr>
                <td>
                    源码介绍：
                </td>
                <td class="td1" style="padding-left: 10px; height: 240px">
                    <input type="hidden" name="description" id="description" value="<%=Server.HtmlEncode(model.Description)%>" />
                    <iframe id="myiframe" src="../Images/Editor/editor.htm?id=description&ReadCookie=0"
                        frameborder="0" scrolling="no" width="620px" height="460px"></iframe>
                </td>
            </tr> <tr>
                <td>
                    标签：
                </td>
                <td class="td1" style="padding-left: 10px">
                    <asp:TextBox ID="txtTags" runat="server" Width="439px"></asp:TextBox>&nbsp; 
                    <br />
                    (多个标签之间请用空格分隔，每个标签最长8个字符，最多4个标签) <td>
            </tr>
            <tr>
                <td>
                </td>
                <td class="td1" style="text-align: center">
                    <asp:Button ID="btnAdd" runat="server" Text="· 提交 ·" OnClick="btnAdd_Click" class="button2">
                    </asp:Button>
                    <input type="reset" value="· 重填 ·" class="button2" />
                </td>
            </tr>
        </table>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllList"
            TypeName="Aspx1.BLL.ProductCategory"></asp:ObjectDataSource>
    </div>
</div>
    <asp:Literal ID="foot" runat="server"></asp:Literal>
    </form>
</body>
</html>


