点发布时,屏幕闪一下,没有任何提示,不进行验证,也没有加到SQL2005库中!
前台:
<%@ Page Language="C#" validateRequest="false" CodeFile="kjxm_Edit.aspx.cs" Inherits="As_Tzxm_Edit" %>
<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2" %>
</head>
<body class="bodybk">
<form id="Form1" method="post" runat="server">
<!--页面布局-->
<table borderColor="black" cellspacing="0" cellpadding="4" width="100%" bgColor="white" border="1">
<tr>
<td height="30" colspan="2" align="center" class="font_1">发 布 信 息</td>
<tr>
<td><asp:button id="btn_3" runat="server" CssClass="btn3_mouseout" Text="提 交" Width="70px" OnClick="btn3_Click"></asp:button></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
后台:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class As_Tzxm_Edit : System.Web.UI.Page
{
private void Kjxm_Big()//读取分类
{
string sql = "select * from Mir_Type where TypeTitleId=" + 2 + " order by TypeId ";
DataTable dt = Class1.ExecSel(sql);
this.CheckBoxList1.DataSource = dt;
this.CheckBoxList1.DataTextField = "TypeName";
this.CheckBoxList1.DataValueField = "TypeId";
this.CheckBoxList1.DataBind();
// this.DropDownList2.Items.Insert(0, new ListItem("请选择", "0"));
}
private void Kjxm_Year()//读取类型
{
string sql1 = "select * from Mir_Type where TypeTitleId=" + 8 + " order by TypeId ";
DataTable dt = Class1.ExecSel(sql1);
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "TypeName";
this.DropDownList1.DataValueField = "TypeId";
this.DropDownList1.DataBind();
this.DropDownList1.Items.Insert(0, new ListItem("请选择", "0"));
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.Kjxm_Big();
this.Kjxm_Year();
}
}
private void Kjxm_Add() //添加项目
{
// Label1.Text = "通过1!";
string Home_Show,Up_Show;
//--------------------------
string Tz_Title = TextBox1.Text.Trim();//机构名称
string Tz_Type = DropDownList1.SelectedValue;//机构性质
string Tz_TypeTitle = DropDownList1.SelectedItem.Text;
// string SortType = DropDownList2.SelectedValue;
// string SortTypeName = DropDownList2.SelectedItem.Text;
string save_cblJL = "";//投资类型
for (int i = 0; i < this.CheckBoxList1.Items.Count; i++)
{
if (this.CheckBoxList1.Items[i].Selected == true)
{
save_cblJL += this.CheckBoxList1.Items[i].Value + ",";
}
else
{
Class1.AlertShow("请选择投资类型!");
}
}
string Content = ftbContent.Value.Replace("'", "'");//公司介绍
//--------------------------
if (Tz_Title == "")
{
Class1.AlertShow("名称不能为空!");
return;
}
else if (Tz_Title.Length > 100)
{
Class1.AlertShow("名称不能大于100个字!");
return;
}
if (this.DropDownList1.SelectedItem.Text == "请选择")
{
Class1.AlertShow("请选择投资类型!");
return;
}
else if (Content == "")
{
Class1.AlertShow("公司介绍不能为空!");
return;
}
string sql = "insert into Tzxmk(TZ_Type,TZ_TypeName,TZ_Title,TZ_Content1)values('" + Tz_Type + "','" + Tz_TypeTitle + "','" + Tz_Title + "','" + Content + "'')";
Class1.ExecSql(sql);
Class1.AlertShow("添加成功!", "Kjxm_Edit.aspx?action=add");
}
protected void btn3_Click(object sender, EventArgs e)
{
if (Request.QueryString["action"] == "add")
{
Kjxm_Add();
}
else if (Request.QueryString["action"] == "edit")
{
// Kjxm_edit();
}
}
}
贴的代码真够乱的,设置一个断点,跟踪调试一下程序,看下程序的走向。
你有访问As_Tzxm_Edit.aspx么
一楼的朋友感觉没有常识,二楼的朋友程序不执行,除了语法检查外!
VS2008下的,断点不会弄啊!