传递参数ID是总是空的

 public partial class RefuseOrdersEdit : BaseAdmin
    {
        protected SmartShop.Entity.RefuseOrders obj_refuseorder = new SmartShop.Entity.RefuseOrders();
        protected SmartShop.Entity.Orders obj_order = new SmartShop.Entity.Orders();

        protected new int ID;
        protected int OrdersTypeID;
        protected string url;
        protected DataTable dt_backorderdetail = new DataTable();
        protected DataTable dt_refusedetail;
        protected string endscript;
        protected decimal payableprice;   //已付金额
        protected StringBuilder Str_endscript_orderdetail, Str_endscript_stock, Str_endscript_finance;
        protected int productmodifing;//是否在修改产品 1 是 0否

 

protected void Page_Load(object sender, EventArgs e)
        {
            ID = GetQueryForInt("ID", 0);
            OrdersTypeID = GetQueryForInt("OrdersTypeID", 0);
            productmodifing = GetQueryForInt("productmodifing", 0);
            url = "RefuseOrdersEdit.aspx?ID=" + ID + "&OrdersTypeID" + OrdersTypeID;
            url = Server.UrlEncode(url);

            if (!IsPostBack)
            {
                if (ID == 0)
                {
                    Response.Redirect("message.aspx?msg='参数id不能为空!'&url=RefuseOrdersDetail.aspx?OrdersTypeID=" + OrdersTypeID);
                }
                else
                {
                    obj_refuseorder = SmartShop.BusLogic.RefuseOrdersLogic.GetEntity(ID);
                    obj_order = SmartShop.BusLogic.OrdersLogic.GetEntity(obj_refuseorder.OrderID);
                    dt_backorderdetail = SmartShop.BusLogic.RefuseOrdersDetailLogic.GetDataTableByRefuseOrdersID(ID);

                }
                obj_order = SmartShop.BusLogic.OrdersLogic.GetEntity(obj_refuseorder.OrderID);  

}

RefuseOrdersDetail.aspx添加功能部分代码:

     int backorderid = SmartShop.BusLogic.RefuseOrdersLogic.Add(obj_backorder);

     bool result = SmartShop.BusLogic.RefuseOrdersDetailLogic.Add(backorderid, ShoppingCookiesStr);

   if (result)
            {
                // 修改订单状态
                SmartShop.BusLogic.OrdersLogic.PiliangStatusTo(OrderID.ToString(), 12);     
                SmartShop.ClassLibrary.JCookie.RemoveCookie("ShoppingCookiesStr");
                Response.Redirect("message.aspx?msg='添加成功!'&url=RefuseOrdersEdit.aspx?=ID " + backorderid);
            }
            else
            {
                Response.Redirect("message.aspx?msg='添加失败!'&url=RefuseOrdersDetail.aspx");
            }

 

 /// <summary>
        /// 获取int类型的Url传值
        /// </summary>
        /// <param name="param">参数名称</param>
        /// <param name="defaultValue">默认值,当但没有得到传值时的默认返回值</param>    
        protected int GetQueryForInt(string param, int defaultValue)
        {
            try
            {
                if (Request.QueryString[param] != null && Request.QueryString[param] != "")
                    return int.Parse(Request.QueryString[param].ToString());
                else
                    return defaultValue;
            }
            catch
            {
                return 0;
            }
        }

问题是:当添加成功时,提示添加成功,然后跳转到RefuseOrdersEdit .aspx页面,跳转是总是提示id为空。、

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值