本帖最后由 qiyuekoushao 于 2011-10-09 11:53:41 编辑

解决方案 »

  1.   

    preThick.aspx 我不知道你在这个页面里做了哪些处理,处理完了之后是否返回了truevar str=xmlHttpReq.responseText; 建议你弹出看看 alert(str);看看是否为true可以肯定的是 更新操作没有问题,问题出在你的返回值上.
      

  2.   

    确实应该是返回值出了问题,但是我不知道错在哪,怎么解决。
    这是我的preThick.aspx代码:
    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="preThick.aspx.cs" Inherits="expertkms_preThick" Title="壁厚信息管理" StylesheetTheme="Default"%><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><div id="divbody" class="divbody">
    <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
        <div id="divheader" class="divheader">
            &nbsp; &nbsp; &nbsp; <b style="color: blue">壁厚推荐值信息管理</b>
        </div>
        <div id="divcontent" class="divProblemcontent" style="position:relative;">
        <div style="width:20%; height:426px; border:solid 1px black;float:left; text-align:center;">
        <div style="margin-top:6px; text-align:left;"><b style="font-size:12px; margin-left:2px;">壁厚信息录入:</b></div>
            <asp:DropDownList ID="DdlmaNa" runat="server" Style="width: 96%; margin-top:6px;">
            </asp:DropDownList>
             <input id="TxtminT" type="text" style="margin-top:6px; width:92%;" value="请输入:最小壁厚"/>
            <input id="TxtsmallRec" type="text" style="margin-top:6px; width:92%;" value="请输入:小型制品壁厚推荐值"/>
             <input id="TxtmidRec" type="text" style="margin-top:6px; width:92%;" value="请输入:中型制品壁厚推荐值"/>
            <input id="TxtbigRec" type="text" style="margin-top:6px; width:92%;" value="请输入:大型制品壁厚推荐值"/>
            <input id="TxtaveT" type="text" style="margin-top:6px; width:92%;" value="请输入:平均厚度"/>
            <input id="TxtmaxT" type="text" style="margin-top:6px; width:92%;" value="请输入:最大厚度"/>
            &nbsp;
            <input id="Button1" type="button" value="提交(S)"  style="margin-top:26px;width:100px; height:28px;background-image: url(image/bullet_green.png); background-repeat: no-repeat; background-color: transparent; background-position: left center;" /> 
            </div>
        <div id="divfilecontent" style="width:58%; height:426px; border:solid 1px black;float:left;text-align:center; overflow:scroll;">
            <table id="tbplaRec" style="width:98%; margin-top:6px; border:solid 1px black;vertical-align:middle; border-collapse:collapse;" border="1" bordercolor="black" cellpadding="1" cellspacing="0">
                <tr style="color:White;position: relative; top: expression(document.getElementById('divbody').scrollTop - 2);">
                        <td style="width: 8%; height: 23px;background-color:Blue; border-right:solid 2px white;">
                        <b>编号</b></td>
                        <td style="height: 23px; display:none;">
                        <b>主键</b></td>
                    <td style="width: 9%; height: 23px;background-color:Blue; border-right:solid 2px white; ">
                        <b style="font-size:12px;">材料牌号</b></td>
                    <td style="width: 19%; height: 23px;background-color:Blue; border-right:solid 2px white; ">
                        <b style="font-size:12px;">材料中文名称</b></td>
                        <td style="width: 9%; height: 23px;background-color:Blue; border-right:solid 2px white; ">
                            <b style="font-size:12px;">最小壁厚</b>(mm)</td>
                            <td style="width: 11%;height: 23px;background-color:Blue;border-right:solid 2px white;">
                                <b style="font-size:12px;">小型制品壁厚推荐值</b>(mm)</td>
                                <td style="width: 11%;height: 23px;background-color:Blue;border-right:solid 2px white;">
                                <b style="font-size:12px;">中型制品壁厚推荐值</b>(mm)</td>
                                <td style="width: 11%;height: 23px;background-color:Blue;border-right:solid 2px white;">
                                <b style="font-size:12px;">大型制品壁厚推荐值</b>(mm)</td>
                                <td style="width: 9%;height: 23px;background-color:Blue;border-right:solid 2px white;">
                                <b style="font-size:12px;">平均厚度</b>(mm)</td>
                                <td style="width: 8%;height: 23px;background-color:Blue;">
                                <b style="font-size:12px;">最大厚度</b>(mm)</td>
                        <td style="width: 15%; height: 23px;background-color:Blue; border-right:solid 2px white; ">
                            <b style="text-decoration: underline;">编辑</b></td>
                            <td style="width: 8%;height: 23px;background-color:Blue;">
                                <b style="text-decoration: underline;">删除</b></td>
                </tr>
            </table>
        </div>
        <div style="width:18%; height:426px; border:solid 1px black;float:left; text-align:center;">
            <div style="margin-top:6px; text-align:left;"><b style="font-size:12px; margin-left:2px;">请输入检索条件:</b></div>
            <asp:DropDownList ID="DdlmaName" runat="server" Style="width: 96%; margin-top:6px;">
            </asp:DropDownList>
            &nbsp;
            <input id="Button2" type="button" value="查询(C)"  style="margin-top:26px;width:100px; height:28px;background-image: url(image/search_keywords_fg.png); background-repeat: no-repeat; background-color: transparent; background-position: left center;" /> 
            
        </div>
        </div>
    </div>
    <script type="text/javascript" src="../js/prethick.js">
    </script>
    </asp:Content>
    麻烦帮我看下,怎么解决啊??急!!!感谢!!
      

  3.   


     protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AddMethod();
            }
        }
        public void AddMethod()
        {
            bool flag = false;
            ///
            ///更新代码
            ///
            //设置 flag=更新代码返回值
            if (flag)
            {
                Response.Clear();
                Response.Write("True");//设置请求返回值
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.Write("False");//设置请求返回值
                Response.End();
            }
        }
      

  4.   


    我试了之后报错,另,这个界面上还有诸如添加、删除、查询等功能,在返回值得问题上又没有出错,
    我是这样改的:public void AddMethod()
        {
            bool flag = false;
            ///
            ///更新代码
            //修改
            if (Request.QueryString["plaRecomId"] != null && Request.QueryString["plaminT"] != null && Request.QueryString["plasmallRec"] != null && Request.QueryString["plamidRec"] != null && Request.QueryString["plabigRec"] != null && Request.QueryString["plaaveT"] != null && Request.QueryString["plamaxT"] != null)
            {
                string plaRecomValueId = Request.QueryString["plaRecomId"].ToString();
                string plaminT = Request.QueryString["plaminT"].ToString();
                string plasmallRec = Request.QueryString["plasmallRec"].ToString();
                string plamidRec = Request.QueryString["plamidRec"].ToString();
                string plabigRec = Request.QueryString["plabigRec"].ToString();
                string plaaveT = Request.QueryString["plaaveT"].ToString();
                string plamaxT = Request.QueryString["plamaxT"].ToString();
                //  Response.Write(EpProcedure.editTbinfoThick("plaRecomValueId", "plaminT", "plasmallRec", "plamidRec", "plabigRec", "plaaveT", "plamaxT"));
                Response.Write(EpProcedure.editTbinfoThick(plaRecomValueId, plaminT, plasmallRec, plamidRec, plabigRec, plaaveT, plamaxT));
           //     Response.End();
          //  }        ///
            //设置 flag=更新代码返回值        flag = Response.Write(EpProcedure.editTbinfoThick(plaRecomValueId, plaminT, plasmallRec, plamidRec, plabigRec, plaaveT, plamaxT));
            if (flag)
            {
                Response.Clear();
                Response.Write("True");//设置请求返回值
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.Write("False");//设置请求返回值
                Response.End();
            }
          }
        }错误:  flag = Response.Write(EpProcedure.editTbinfoThick(plaRecomValueId, plaminT, plasmallRec, plamidRec, plabigRec, plaaveT, plamaxT));
    这一行无法将类型void隐式转换为bool
      

  5.   

    在你的js文件里
     var str=xmlHttpReq.responseText;
      if( str =="true")
    可以改成
    if(str!=null)么?  因为responseText返回来的值怎么会只是true或false呢
      

  6.   

    感谢8楼,这样确实可以!但是如果str是false的时候,false是为空吗?提交失败的情况要考虑。如果加个或可以吧?额,JS文件中的“或”是用什么符号?
      

  7.   

    EpProcedure.editTbinfoThick()这个东西又是干嘛的 你的代码真是乱的一塌糊涂
      

  8.   

    EpProcedure.editTbinfoThick()这个东西又是干嘛的 你的代码真是乱的一塌糊涂
      

  9.   

    你把他提交个另外一个空白的页面好处理点,把那个页面的html代码删了,那样Response.Write的时候就不会有其他东西干扰了
      

  10.   


    和C#一样  &&与运算  ||或运算   你这里应该用与运算  即不为null同时也不为false