User Profile & Activity

Michael Zhou Member
Posted: May 10, 2012 3:10 AM

Yes, we edit multiple rows in the client  ,and then send to the server to save data .

Under the development ,the application run correct ,but when we deployed , we visit the application  some error occur.

We capture some picture as attachment.

1, load data  in the page_load event:

 protected void Page_Load(object sender, EventArgs e)
        {
             LoadPriceSysList()
        }

        /// <summary>
        /// Load data in the page_load event
        /// </summary>
        private void LoadPriceSysList()
        {
            wgrdView.DataSource = _contractfacade.GetPriceSysList(pricesys);
            wgrdView.DataBind();
        }

2, add new row by click add button which from asp.net:

    protected void btnAdd_Click(object sender, EventArgs e)
        {
           
            DataTable dt = wgrdView.DataSource as DataTable;
            if (dt == null)
            {
                DataTable newDT = new DataTable();
                DefineDataTable(newDT);
                DataRow dr = newDT.NewRow();
                dr["id"] = Guid.NewGuid();
                dr["sys_id"] = pricesys;
                newDT.Rows.Add(dr);
                wgrdView.DataSource = newDT;
                wgrdView.DataBind();
            }
            else
            {
                DataRow dr = dt.NewRow();
                dr["id"] = Guid.NewGuid();
                dr["sys_id"] = pricesys;
                dt.Rows.Add(dr);
                wgrdView.DataSource = dt;
                wgrdView.DataBind();
            }
        }

3, save data by click save button  which from asp.net:

  DataTable dt = wgrdView.DataSource as DataTable;
            if (dt == null)
            {
                CommFun.Alert(VankeResource.pleaseTryAgain, this.Page);
                return;
            }
          

            List<PriceSysList> lst_psl = new List<PriceSysList>();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    PriceSysList m = new PriceSysList();
                    m.id = dr["id"].ToString();
                    m.sys_id = hidsys_id.Value;
                    m.out_name = dr["out_name"].ToString();
                    m.model = dr["model"].ToString();
                    m.brand = dr["brand"].ToString();
                    m.origin = dr["origin"].ToString();
                    m.quote_amount = TypeConverter.StrToDouble(dr["quote_amount"].ToString());
                    m.equiment_amount = TypeConverter.StrToDouble(dr["equiment_amount"].ToString());
                    m.install_amount = TypeConverter.StrToDouble(dr["install_amount"].ToString());
                    m.pipeline_amount = TypeConverter.StrToDouble(dr["pipeline_amount"].ToString());
                    m.profit_rate = TypeConverter.StrToDouble(dr["profit_rate"].ToString());
                    m.manage_rate = TypeConverter.StrToDouble(dr["manage_rate"].ToString());
                    m.remark = dr["remark"].ToString();
                    lst_psl.Add(m);
                }

                List<PriceSysList> lst = lst_psl;
               
                int reint = _contractfacade.AddPricesysList(lst_psl);
                if (reint >= (int)CommEnum.sqlRetTips.success)
                {
                    CommFun.Alert(VankeResource.SaveSuccess, Page);
                }
                else
                {
                    CommFun.Alert(VankeResource.SaveFailed, Page);
                }
            }

  4 , some error occur :

        1): bind data lost

         2): or exception from webgrid

 

 

 
Posted: May 10, 2012 3:10 AM

Yes, we edit multiple rows in the client  ,and then send to the server to save data .

Under the development ,the application run correct ,but when we deployed , we visit the application  some error occur.

We capture some picture as attachment.

1, load data  in the page_load event:

 protected void Page_Load(object sender, EventArgs e)
        {
             LoadPriceSysList()
        }

        /// <summary>
        /// Load data in the page_load event
        /// </summary>
        private void LoadPriceSysList()
        {
            wgrdView.DataSource = _contractfacade.GetPriceSysList(pricesys);
            wgrdView.DataBind();
        }

2, add new row by click add button which from asp.net:

    protected void btnAdd_Click(object sender, EventArgs e)
        {
           
            DataTable dt = wgrdView.DataSource as DataTable;
            if (dt == null)
            {
                DataTable newDT = new DataTable();
                DefineDataTable(newDT);
                DataRow dr = newDT.NewRow();
                dr["id"] = Guid.NewGuid();
                dr["sys_id"] = pricesys;
                newDT.Rows.Add(dr);
                wgrdView.DataSource = newDT;
                wgrdView.DataBind();
            }
            else
            {
                DataRow dr = dt.NewRow();
                dr["id"] = Guid.NewGuid();
                dr["sys_id"] = pricesys;
                dt.Rows.Add(dr);
                wgrdView.DataSource = dt;
                wgrdView.DataBind();
            }
        }

3, save data by click save button  which from asp.net:

  DataTable dt = wgrdView.DataSource as DataTable;
            if (dt == null)
            {
                CommFun.Alert(VankeResource.pleaseTryAgain, this.Page);
                return;
            }
          

            List<PriceSysList> lst_psl = new List<PriceSysList>();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    PriceSysList m = new PriceSysList();
                    m.id = dr["id"].ToString();
                    m.sys_id = hidsys_id.Value;
                    m.out_name = dr["out_name"].ToString();
                    m.model = dr["model"].ToString();
                    m.brand = dr["brand"].ToString();
                    m.origin = dr["origin"].ToString();
                    m.quote_amount = TypeConverter.StrToDouble(dr["quote_amount"].ToString());
                    m.equiment_amount = TypeConverter.StrToDouble(dr["equiment_amount"].ToString());
                    m.install_amount = TypeConverter.StrToDouble(dr["install_amount"].ToString());
                    m.pipeline_amount = TypeConverter.StrToDouble(dr["pipeline_amount"].ToString());
                    m.profit_rate = TypeConverter.StrToDouble(dr["profit_rate"].ToString());
                    m.manage_rate = TypeConverter.StrToDouble(dr["manage_rate"].ToString());
                    m.remark = dr["remark"].ToString();
                    lst_psl.Add(m);
                }

                List<PriceSysList> lst = lst_psl;
               
                int reint = _contractfacade.AddPricesysList(lst_psl);
                if (reint >= (int)CommEnum.sqlRetTips.success)
                {
                    CommFun.Alert(VankeResource.SaveSuccess, Page);
                }
                else
                {
                    CommFun.Alert(VankeResource.SaveFailed, Page);
                }
            }

  4 , some error occur :

 

 

 

All times are GMT -5. The time now is 3:21 PM.
Previous Next