2
I have the following form code:
@model Domain.Entities.Tabela1
@using WebUI.HtmlHelpers
@using WebUI.Extensions
@{
ViewBag.Title = "Tabela";
Layout = "~/Views/Shared/_Master.cshtml";
}
<article ng-app="registrationModule">
<section>
<div>
<div ng-controller="Tabela1FormController">
<form class="form" name="tabela1Form" ng-submit="save(tabela1)" novalidate style="width: 700px; margin-left: auto; margin-right: auto;">
</div>
<div>
<div>
<label for="name">Nome:</label>
<input type="text" name="name" ng-model="tabela1.name" />
</div>
</div>
//Aqui eu gostaria de busca a informação
<input type="text" name="name" ng-model="tabela2.medida" />
My Entities Table 1:
[Table("Tabela1")]
public class Tabela1
{
[Key]
public int tabela1ID{ get; set; }
//Strings
[Required(ErrorMessage = "O campo \"Nome\" é obrigatório")]
public string Name { get; set; }
[Required(ErrorMessage="O campo \"Unidade de Medida\" é obrigatório")]
public string medida{ get; set; }
//Collections
public ICollection<Coleçao> campo { get; set; }
public tabela1()
{
campo= new HashSet<Coleçao>();
}
Entitie tabela2:
public class tabela2
{
public static tabela2 Default = new tabela2();
[Key]
public int tabela2ID { get; set; }
public string Unit { get; set; }
[Required(ErrorMessage = "Digite um símbolo da unidade de medida")]
public string Symbol { get; set; }
}
Listview Tabela1
public class tabela1ListViewModel : PaginationViewModel
{
public IEnumerable<tabela1> tabela1{ get; set; }
}
My control:
public ActionResult Newtabelar()
{
return View("tabelaForm");
}
[Permission(Path = IndicatorPath.tabela, Permission = PermissionType.ReadWrite)]
public ActionResult EditItabela(int tabelaid, bool onlyRead = false)
{
var tabela = tabela1Repository
.tabela1
.Include(x => x.tabela3)
.Include(x => x.tabela4)
.Include(x => x.tabela5)
.Include(x => x.tabela6)
.FirstOrDefault(x => x.tabela1id == tabela1id);
ViewBag.OnlyRead = onlyRead;
return View("tabela1Form", tabela);
}
Well to Tabela1 one he seeks ok, but the table2 want to play the field she has in a select in the form it does not search, my view was made with angular, as I must proceed to solve this problem. thanks in advance.
What do you mean "no search", can you explain better? Error? What code are you using to get the table values?
– Ricardo Pontual
I cannot bring the information from table 2 to the desired field.
– Bruno H.
Tabela1 is related to two others and table2 is not.
– Bruno H.
What exactly do you want to access that you’re not getting?
– Cassio Alves
i want to access the Unit field of the table2, I do not know if by the angle I take the information and put in the <input type="text" name="name" ng-model="table2.measure" />
– Bruno H.