2012-03-28 3 views
1

こんにちはすべて私はその上にこれらのコントロールとの見解を持っているビューから値を送信する方法は?

<input type="text" class="radius2" /> 
<input type="button" value="Place bid" class="bid-btn" /> 

私はボタンがクリックされたときに(アクションメソッドを経由して)別のビューにテキストボックスに値を渡したいです。アクションメソッドはビューをレンダリングする必要があります。

これはどのように達成できますか?サーバは彼らに

<input name="Name1" type="text" class="radius2" /> 
<input type="button" value="Place bid" class="bid-btn" /> 

にアクセスできるように

おかげで、

サチン

答えて

2
のようなものでなければなりません
@using(Html.BeginForm("SubmitAction", "Home", FormMethod.Post)) 
{ 

    <input id="radius2" name="radius2" type="text" class="radius2" /> 
    <input type="submit" value="Place bid" class="bid-btn" /> 

} 
    [HttpPost] 
    public ActionResult SubmitAction(string radius2) 
    { 
     return AnotherView(radius2); 
    } 

    public ActionResult AnotherView(string value) 
    { 
     return View(); 
    } 

メモ帳で書かれているため、構文の変更が必要な場合があります

1

は、タグにnameプロパティを追加提出するときに、あなたの行動は、この

public ActionResult SubmitAction(string name1) 
{ 
    return View("ViewName" , /* the model here */) 
} 
+0

私はこのタイプを "submit" –

関連する問題