-1

ビューに 3 つのラジオ ボタンと 2 つのテキスト ボックスがあります。最初にビューを介してDBに値を保存する必要があり、保存したら、クリックしたラジオボタンに応じて特定のビューに保存された値を表示する必要があります。

4

2 に答える 2

0

1 つの方法は、値をコントローラー メソッドにポストして保存し、値を使用して新しいビューをレンダリングすることです。

于 2013-07-01T04:25:44.090 に答える
0
This got solved. We can use JQuery to achive tgis

View
--------

  var url = '@Url.Action("YourActionName", "YourControllerName")';
  $.post(url, 'ID=' + radio button Id , function (data) {   
         $('#txtBox1').val(data.Key1);         
         $('#txtBox2').val(data.Key2);  
         $('#txtBox3').val(data.Key3);  
}

Controller
----------
 Inside your action method , construct a JSON string as showed below and send back to JQuery Function.

  var dataTest = new { "Key1"= "value1","Key2"= "value2", "Key3"= "value3" };  
  return Json(dataTest, JsonRequestBehavior.AllowGet);
于 2013-07-11T09:16:06.400 に答える