2012-01-17 4 views
0

を選択しなさい:は私が私の見解では、次の選択コントロールを持つアイテム(のasp.net MVC)

<select id="countriesMultiselect" name="countriesMultiselect" multiple="multiple" 
      style="width: 180px; font-size: 10px; text-align: left;"> 
      @foreach (var region in Model.RegionsHierarchy) 
      { 
       if (region.Children != null && region.Children.Count > 0) 
       { 
       <optgroup id="@region.MdsId" label="@region.Name"> 
        @foreach (var childRegion in region.Children) 
        { 
         <option id="@childRegion.MdsId">@childRegion.Name</option> 
        } 
        @*</option>*@ 
       </optgroup> 
       } 
       else 
       { 
       <option id="@region.MdsId">@region.Name</option> 
       } 
      } 
     </select> 

私は送信ボタンをクリックすると、コントローラのアクションが呼び出されます。どのように

public RedirectToRouteResult Search(SearcherViewModel model) 
      { 
//do some stuff 
       return RedirectToAction("Index"); 
      } 

選択したアイテムを入手できますか?

答えて

0

このタグスープをcustom html helperに置き換えて、これを処理することをお勧めします。

+0

実際には今は使用できません。私のモデルに選択したアイテムを持たせるために何ができるのですか? –

+0

@niao、あなたがそれを使用できない理由はありません。私は本当に同じ問題を抱えている他の人々が私が間違って考えているものと同じことをするかもしれないので、Stack Overflowに悪いアドバイスを与えるのは嫌です。私はすでに私の推薦を提供しています。あなたがそれを気に入らなければ、私はあなたの意見に感謝し、問題を解決するのに幸運を祈っています。 –

+0

それは十分公正である –

関連する問題