protected void Button8_Click(object sender, EventArgs e)
{
if (TextBox4.Equals(""))
{
Response.Write("<script>alert(‘标题不能为空’);</script>");
}
else if (TextBox5.Equals(""))
{
Response.Write("<script>alert(‘副标题不能为空’);</script>");
}
else if (FCKeditor1.Equals("") || FCKeditor1.ToString().Length > 7000)
{
Response.Write("<script>alert(‘内容限定为7000字’);</script>");
}
else if (DropDownList3.SelectedValue.ToString().Equals(""))
{
Response.Write("<script>alert(‘请选择频道’);</script>");
}
else if (DropDownList1.SelectedValue.Equals(""))
{
mbmt.t_title = TextBox4.Text.ToString();
mbmt.t_addtitle = TextBox5.Text.ToString();
mbmt.t_content = FCKeditor1.Value.ToString();
mbmt.t_mainPic = TextBox6.Text.Trim().ToString();
mbmt.t_orderid = DropDownList4.SelectedIndex;
mbmt.t_channelid = Convert.ToInt32(DropDownList3.SelectedValue.ToString());
mbmt.t_topicid = 0;
mbmt.t_addtime = System.DateTime.Now.ToString("yyyy-MM-dd");
int j = mbt.Add(mbmt);
if (j > 0)
{
Response.Write("<script>alert(‘添加成功’);</script>");
}
else
{
Response.Write("<script>alert(‘添加失败’);</script>");
}
}
else
{
mbmt.t_title = TextBox4.Text.ToString();
mbmt.t_addtitle = TextBox5.Text.ToString();
mbmt.t_content = FCKeditor1.Value.ToString();
mbmt.t_mainPic = TextBox6.Text.Trim().ToString();
mbmt.t_orderid = DropDownList4.SelectedIndex;
mbmt.t_channelid = Convert.ToInt32(DropDownList3.SelectedValue.ToString());
mbmt.t_topicid = DropDownList1.SelectedIndex;
mbmt.t_addtime = System.DateTime.Now.ToString("yyyy-MM-dd");
int j = mbt.Add(mbmt);
if (j > 0)
{
Response.Write("<script>alert(‘添加成功’);</script>");
}
else
{
Response.Write("<script>alert(‘添加失败’);</script>");
}
}
如上,问题是我一点击添加按钮直接跳到添加成功而没有经过判断!!!!!!
我的代码我看不出来哪里有问题!

断点下 看那些逻辑都走不走 看起来没啥问题啊
是TextBox4.Text.Equals("")吧?
你可以设置一个断点进行调试啊!!看它为什么会直接添加成功咯
是TextBox4.Text.Equals("")写错了。。
应该是文本框.Text.Equals("")lz写错了好像….