解决方案 »
- 不知道下面代码中的Request["u"]是哪里来的
- 使用forms验证后,根目录下的某一文件夹内的网页怎么调用根目录下其他文件夹内的图片CSS等资源
- 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。分少了 没人来 。。。。。。。。。。。。。。。。。。。。。。。。。。。
- DataGrid 在排序情况下 删除问题怎么解决
- 一个复杂的问题,,不知有何方法能实现?
- 网页上控件的title属性里的文本怎么换行(在线等,解答马上给分)
- 求一sql
- 一个小问题,我没分了只有这么多,大家帮帮忙啊!!
- 关于报表倒入word excel时的问题
- 请教excel表的问题
- 点击删除,如何判断是否选中,如未选中弹出提示,选中后弹出是否删除提示框
- GPL, AGPL相关问题
两种方法:
第一种:采用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();
}
$(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[" "]显示