<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="DissData_cs" %>
	<script language="C#" runat="server">
	DissSql NowDissSQL = null;
	void Page_load(object sender,EventArgs e){
		Cname.Text=Session["NowMan"].ToString();
		DissSql NowDissSQL = (DissSql)Session["NowDissSQL"];
		DataTable NowTable;
		NowTable =NowDissSQL.GetAllCate();
		cate.DataSource=NowTable.DefaultView;
		cate.DataValueField="id";
		cate.DataTextField="cate";
		cate.DataBind();
	}
	void ok_click(object sender,EventArgs e){
		DissSql NowDissSQL = (DissSql)Session["NowDissSQL"];
		int x = NowDissSQL.GetMaxID();
		Boolean k=NowDissSQL.SaveToArticle(x,0,Subj.Text,Cname.Text,Body.Text,Convert.ToInt32(cate.SelectedItem.Value),Session["NowID"].ToString());
		if(k==true){
			Response.Redirect("ShowSbj.aspx?NowCateID=" + cate.SelectedItem.Value);
		}
		else{
			Msg.Text="发生错误，无法保存";
		}
	}
	void cel_click(object sender,EventArgs e){
		Response.Redirect("showsbj.aspx?NowCateID=1");
	}
	</script>
</head>
<body background="../../../../images/winback.gif">
<form runat="server">
<table><tr><td>大名:</td><td><asp:textbox columns="50" ID="Cname" Runat="server" /></td></tr>
<table><tr><td>主题:</td><td><asp:textbox columns="60" ID="Subj" Runat="server" /></td></tr>
<tr><td>选择类别:</td><td><asp:dropdownlist ID="cate" Runat="server" /></td></tr>
<tr><td valign="top">意见或问题:</td><td><asp:Textbox ID="Body" Rows="7" Columns="45" TextMode="MultiLine" Runat="server" /></td></tr>
<tr><td><asp:button id="ok" runat="server" onclick="ok_click" text="确定" />  <asp:button id="cel" runat="server" onclick="cel_click" text="取消" />
</table>
<asp:Label id="Msg" Runat="server" />
</form>
</body>