日期:2014-05-20  浏览次数:20532 次

有什么错?
我用一个页面实现新增和修改的功能,想在操作成功后给个提示后转到另一页,但是在新增时不给提示也无任何反应(实际已操作成功),修改时可以,为什么呢?

后台代码
private   void   btnSubmit_Click(object   sender,   System.EventArgs   e)
{
string   []   fields   =   new   string[]{ "ID ", "PID ", "FName ", "Comment ", "isort ", "HID "};
Control   []   ctrls   =   new   Control[]{txtID,lsdMayor,txtFName,txtComment,lblIflag};
Config   con   =   new   Config(Page);
bool   isRun   =   true;
if   (txtID.Text   !=   " ")
{
isRun=con.RunSql(con.GetSQL(fields,ctrls, "querytol ",true,null));
}
else
{
con.TranRunSqlGet(con.GetSQL(fields,ctrls, "querytol ",false,null), "select   IDENT_CURRENT( 'querytol ') ",txtID);
}
if(isRun)
{
isRun=con.RunSqlPara(new   string   []{ "Content "},new   object[]{new   System.Text.StringBuilder(txtContent.Text)}, "QueryTol ", "ID= "+txtID.Text);
}
con.Close();
if   (isRun)
{
Page.RegisterStartupScript( " ", " <SCRIPT   language=javascript> alert( '信息提交成功! ');document.location.href= '../main/ListQuery.aspx?tid= "+lblIflag.Text+ " ' </SCRIPT> ");
}
else
{
con.Fail();
}
}
前台代码


<form   id= "frmEdit "   method= "post "   runat= "server ">
<div   class= "Title "> <asp:label   ID=lblTitle   Runat=server> </asp:label> <asp:label   ID= "lblIflag "   Runat=server   Visible=False> </asp:label> 编辑 <asp:textbox   id= "txtID "   runat= "server "   Width= "0 "> </asp:textbox> <asp:textbox   id= "txtWhere "   runat= "server "   Width= "0 "> </asp:textbox> <asp:label   id= "lblUrl "   Runat= "server "   Visible= "False "> </asp:label> <asp:label   id= "lbl "   Runat= "server "   Visible= "False "> </asp:label> </div>
<table   class= "tbl "   borderColor= "#cad1a5 "   height= "90% "   cellSpacing= "0 "   width= "90% "   align= "center "
border= "1 ">
<tr   height= "35 ">
<td   align= "right "> 文件名称 </td>
<td> <asp:textbox   id= "txtFName "   runat= "server "   maxlength= "50 "   width= "90% "> </asp:textbox> </td>
</tr>
<tr   height= "35 ">
<td   align= "right "> 简要说明: </td>
<td> <asp:textbox   id= "txtComment "   runat= "server "   maxlength= "200 "   width= "100% "   TextMode= "MultiLine "> </asp:textbox> </td>
</tr>
<tr>
<td   align= "right "   width= "15% "   rowSpan= "2 "> 内容: <asp:textbox   id= "txtContent "   Width= "0 "   Runat= "server "> </asp:textbox> </td>
<td   height= "35 "> <asp:button   id= "btnQuery "   Runat= "server "   Text= "设置条件 "> </asp:button> </td>