2013-11-09 61 views
0
public ActionResult MultipleTab(int? SelectedCustomerID) 
    { 
    Session["SelectedCustomerID"] = SelectedCustomerID; 
    return view(); 
    } 

我根據選定的客戶ID(可選擇多個客戶)在瀏覽器中打開多個選項卡。使用會話的多個選項卡

我遇到了會話問題。

如果讓我選擇的多客戶* (超過1的客戶 *)我每次插入第一個會話數據。

如何解決使用會話多個選項卡的問題,或者你有另一種解決方案來實現這個在asp.net mvc?

任何幫助將被賞識。

謝謝。

回答

0

當你需要你的客戶ID時,你可以使用querystrings。

例如

而是採用 會話[ 「SelectedCustomerID」]

嘗試使用此 的Request.QueryString [ 「SelectedCustomerID」]

0

添加您SelectedCustomerIDList,並添加此List到Session。

List<int> myList = new List<int>(); 
myList = (List<int>)Session["SelectedCustomerID"]; 
myList.Add(SelectedCustomerID); 
Session["SelectedCustomerID"] = myList; 
+0

我怎麼知道哪個會話被選中? – user2959726

+0

我不清楚你的意思!你想使用「多個會話」還是「像數組一樣的多個會話值」?告訴我有關您的功能的更多信息,並且我想知道上面的答案對您有用嗎?你爲什麼接受? – zey

+0

我在tab中打開客戶。例如,我打開5個客戶頁面,如果我想更改3.客戶數據,我更改了客戶數據,因爲會話。 – user2959726