问题描述
本人想开发一个web方式下的进销存系统,入库单据分主、明细表单录入方式(如下图);但当输入第一行数据的物品编码,再输入数量时,系统会将之前输入的数据清除,或输入多行后,再发现第一行有问题重新输入也开将其他行数据清除掉,请问该怎样解决该问题?[img=http://photo.163.com/photo/long3401/?u=long3401#m=2&ai=48139081&pi=2253779150&p=1][/img]//输入物品编码时,显示其它(如规格、厚度等)信息到表单上protectedvoidtxt_item_no_TextChanged(objectsender,EventArgse){DataOperatorop=newDataOperator();DataInfo.ItemInfoToGriditeminfo=newDataInfo.ItemInfoToGrid();GridViewRowrow;for(inti=0;i<GridView1.Rows.Count;i++){row=GridView1.Rows[i];string_item_no=((TextBox)row.FindControl("txt_item_no")).Text;string_item_name=((TextBox)row.FindControl("txt_item_name")).Text;//ScriptManager.RegisterStartupScript(updatePanelGridView,typeof(UpdatePanel),"ScriptName","alert("+_item_no+")",true);if(_item_no!=string.Empty&&_item_name==string.Empty){if(op.GetItemInfoNO(_item_no)){//string_item_name=((TextBox)row.FindControl("txt_item_name")).Text;iteminfo=GetItemInfoToGrid(_item_no);//GridView1.Rows[i].Cells[1].Text=iteminfo.item_no;GridView1.Rows[i].Cells[2].Text=iteminfo.item_name;GridView1.Rows[i].Cells[3].Text=iteminfo.item_size;GridView1.Rows[i].Cells[4].Text=iteminfo.item_grade;GridView1.Rows[i].Cells[5].Text=iteminfo.item_spec;GridView1.Rows[i].Cells[6].Text=iteminfo.item_panel;GridView1.Rows[i].Cells[7].Text=iteminfo.item_packe;string_iquantity=iteminfo.weight_hb.ToString();GridView1.Rows[i].Cells[14].Text=String.Format("{0:F3}",_iquantity);continue;}else{ScriptManager.RegisterStartupScript(updatePanelGridView,typeof(UpdatePanel),"ScriptName","alert('输入的物品编码错误,请重新输入!')",true);break;}}}}//输入架(箱)时计算重量箱并赋上到单元格上protectedvoidtxt_inum_TextChanged(objectsender,EventArgse){GridViewRowrow;floatinum,weight_hb,iquantity;for(inti=0;i<GridView1.Rows.Count;i++){row=GridView1.Rows[i];string_inum=((TextBox)row.FindControl("txt_inum")).Text;string_weight_hb=((TextBox)row.FindControl("txt_weight_hb")).Text;if(_inum!=string.Empty&&_weight_hb!=string.Empty){//ScriptManager.RegisterStartupScript(updatePanelGridView,typeof(UpdatePanel),"ScriptName","alert("+_weight_hb+")",true);inum=float.Parse(_inum);weight_hb=float.Parse(_weight_hb);iquantity=inum*weight_hb;string_iquantity=iquantity.ToString();GridView1.Rows[i].Cells[9].Text=String.Format("{0:F3}",_iquantity);continue;}elsebreak;}}
解决方案
解决方案二:
我帮你顶
解决方案三:
你可以用ajax的无刷新实现
解决方案四:
你可以用ajax的无刷新实现