I'm trying to show some data in some in some bootstrap textboxes.
Normally in Webforms I'd set a dataset and set the .Text properties of textboxes by using something like TextBox.Text=Datatable.Rows[0]["FieldName"].ToString() but being new to MVC got me clueless.
Anyways here is what I have
I have an actionresult like this, where I get the data from DB. Data comes nicely. All I need to do is get them hooked together.
public ActionResult CompanySettings()
{
ClaimsIdentity identity = (ClaimsIdentity)User.Identity;
int CompanyId = Convert.ToInt32(identity.FindFirst("CompanyId").Value);
//-----------------------------
ViewBag.CompanyId = CompanyId;
ViewBag.Page = "Inbox";
string Name = identity.Name;
string CompanyName = identity.FindFirst("CompanyName").Value;
ViewBag.Name = Name;
ViewBag.CompanyName = CompanyName;
//-----------------------------
DataSet ds = CompanyDB.Company_Get_Info(CompanyId);
return View();
}
and my ViewModel (showing only one field as a n example)
public class CompanySettingViewModel
{
[Display(Name = "CompanyType")]
public CompanyType CompanyType { get; set; }
//and many more fields like this.
}
I'm posting my html part too in any case
<table>
<tr>
<td>
<div class="registerbox-textbox">
<h6>Company Type</h6>
@Html.Bootstrap().TextBoxFor(t=>t.CompanyType).Placeholder("FirmaTipi")
</div>
</td>
//again many repeating same type fields inside a table
<tr>
<table>
This is probably something very simple and easy but I'm stuck. Does anyone have any idea?