ビューに 4 つのテキスト ボックスがあり、テーブル構造のために、データベースから取得した値を変数にまとめて割り当てる必要があります。現在、ビュー内のコントロールに値を割り当て、同じコントロールを使用して同じデータベースを更新するという問題に直面しています。助けてください、
public ActionResult Index()
{
// SettingsModel smodel = new SettingsModel();
// tblSettings tableset = new tblSettings();
var dat = _Settings.GetSettings().ToDictionary(s => s.Desc, s => s.Settings, StringComparer.Ordinal);
return View();
}
モデルを使用してビューにあるテキストボックスにこれらの値を適用する方法がわかりませんでした。テキストボックスを使用して同じテーブルを更新する必要があるため
テーブル構造: ID(int)、Settings(nvarchar)、Desc (nvarchar)
アップデート:
@(Html.Kendo().TimePicker()
.Name("startpicker")
.Interval(60)
//.Value("10:00 AM")
)
@(Html.Kendo().TimePicker()
.Name("endpicker")
.Interval(60)
//.Value("10:00 AM")
)
<td>@Html.TextBoxFor(Model => Model.DefaultState, new { @class = "k-textbox", style = "width: 118px;", id = "statetxt" }) </td>
返信ありがとうございます。tooltipcheckbox と kendo timepicker を除くすべての値が割り当てられます。
HEreはコントローラーの私のコードです:
settingsmodel smodel=new settingsmodel(); if (dat.ContainsKey("Tooltips")) smodel.tooltip =Convert.ToBoolean(dat["Tooltips"]);
// ツールチップで値 0 を取得します // 文字列が有効なブール値として認識されなかったため、エラーをスローします
設定モデル:
public bool tooltip { get; set; }