解决方案 »

  1.   

    当做参数请求那个view,view里写一个获取参数的controller
      

  2.   

    在请求时带上取到的值作为参数,ajax和服务器交互时把参数传过去,controller接到参数放到viewbag或viewdata里面。在第二个view获取便可。
      

  3.   

    还是本人来结贴吧。
    两种方法:
    第一种:采用session存值传递到另一个ResultAction
    代码如下: public ActionResult Hotel_search(string passport, string country, string city, string location, string enterTime, string leaveTime, string oneInput, string bigInput, string twoInput, string threeInput, string fourInput, string hotelName, string hotelWriteName)
            {
                Session["passport"] = passport;
                //Session["country"] = country;
                //Session["city"] = city;
                //Session["location"] = location;
                //Session["enterTime"] = enterTime;
                //Session["leaveTime"] = leaveTime;
                //Session["oneInput"] = oneInput;
                //Session["bigInput"] = bigInput;
                //Session["twoInput"] = twoInput;
                //Session["threeInput"] = threeInput;
                //Session["fourInput"] = fourInput;
                //Session["hotelName"] = hotelName;
                //Session["hotelWriteName"] = hotelWriteName;
                
                return Redirect("Order_condition");
           
            }
    在另一个Action里代码如下:
      public ActionResult Order_condition(string passport, string country, string city, string location, string enterTime, string leaveTime, string oneInput, string bigInput, string twoInput, string threeInput, string fourInput)
            {
                ViewData["passport"] = Session["passport"].ToString();
                ViewData["country"] =Session["country"].ToString();
                ViewData["city"] = Session["city"].ToString();
                ViewData["location"] = Session["location"].ToString();
                ViewData["enterTime"] = Session["enterTime"].ToString();
                ViewData["leaveTime"] = Session["leaveTime"].ToString();
                ViewData["oneInput"] = Session["oneInput"].ToString();
                ViewData["bigInput"] = Session["bigInput"].ToString();
                ViewData["twoInput"] = Session["twoInput"].ToString();
                ViewData["threeInput"] = Session["threeInput"].ToString();
                ViewData["fourInput"] = Session["fourInput"].ToString();
                return View();
            }
      

  4.   

    第二个方法,直接在Hotel_search.js上的代码上改:
    $(function () {
        $("#btn_search_Hotel_search").click(function () {
            toAction("Order_condition", "Customer", "passport=" + $("#txt_passport_Hotel_search").val() +
                "&country=" + $("#txt_country_Hotel_search").val() +
                "&city=" + $("#txt_city_Hotel_search").val() +
                "&location=" + $("#txt_location_Hotel_search").val() +
                "&enterTime=" + $("#txt_enter_time_Hotel_search").val() +
                "&leaveTime=" + $("#txt_leave_time_Hotel_search").val() +
                "&oneInput=" + $("#txt_one_input_Hotel_search").val() +
                "&bigInput=" + $("#txt_big_input_Hotel_search").val() +
                "&twoInput=" + $("#txt_two_input_Hotel_search").val() +
                "&threeInput=" + $("#txt_three_input_Hotel_search").val() +
                "&fourInput=" + $("#txt_four_input_Hotel_search").val() +
                "&hotelName=" + $("#txt_hotel_name_Hotel_search").val() +
                "&hotelWriteName=" + $("#txt_hotelName_write_Hotel_search").val());    });    function getData4Post(actionName, controllerName, paramData) {        var actionUrl = getActionUrl(actionName, controllerName);        try {            $.ajax({
                    type: "POST",
                    url: actionUrl,
                    data: paramData,
                    success: function (data) {
                        //alert(data.Passport + " " + data.Country + " " + data.City);
                        toAction("Order_condition", "Customer");
                    }
                });
            } catch (e) {
                alert(e);
            }
        };
    });
    然后直接在Order_condition上显示:
       public ActionResult Order_condition(int passport, string country, string city, string location, DateTime enterTime, DateTime leaveTime, int oneInput, int bigInput, int twoInput, int threeInput, int fourInput)
            {
                ViewData["passport"] = passport;
                ViewData["country"] = country;
                ViewData["city"] = city;
                ViewData["location"] = location;
                ViewData["enterTime"] = enterTime;
                ViewData["leaveTime"] = leaveTime;
                ViewData["oneInput"] = oneInput;
                ViewData["bigInput"] = bigInput;
                ViewData["twoInput"] = twoInput;
                ViewData["threeInput"] = threeInput;
                ViewData["fourInput"] = fourInput;
                return View();
            }
    这两种都能把参数给到View所属的ActionResult里,然后再传到相对应的页面,直接用ViewData[" "]显示
      

  5.   

    6楼的,我是初学者,用Session的方法还是自己从网上查找的。至于你说的直接ViewData,你可以自己代码实现一下看可不可以。