I'm new to Development, and I'm doing a screen that has a GridView that when I click on the ADD button of the text it writes the Label on the line but sends the text to the other line, I wanted to know how to make the text in the same line and Add Label on the next line, and so on
@model CeoScrum.Models.Funcionalidade
@{
ViewBag.Title = (Model != null && Model.Id > 0 ? "Edicao" : "Cadastro") + " de funcionalidade";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section HeadSection{
<script type="text/javascript">
function Adicionar() {
$("#tbFuncionalidadeAcao tbody").append(
"<tr>"+
"<td><input type='text'/></td>"+
"<td><input type='text'/></td>"+
"<td><img src='/CeoScrum/Content/css/icone/icon_add.png' class='btnAdicionar'/><img src='/CeoScrum/Content/css/icone/icon_excluir.png' class='btnExcluir'/></td>" +
"</tr>");
var par = $(this).parent().parent();
var tdNome = par.children("td:nth-child(1)");
var tdMnemonico = par.children("td:nth-child(2)");
var tdBotoes = par.children("td:nth-child(3)");
tdNome.html(tdNome.children("input[type=text]").val());
tdMnemonico.html(tdMnemonico.children("input[type=text]").val());
tdBotoes.html("<img src = '/CeoScrum/Content/css/icone/icon_editar.png' class = 'btnEditar'/><img src='/CeoScrum/Content/css/icone/icon_excluir.png' class='btnExcluir'/>");
$(".btnEditar").bind("click", Editar);
$(".btnExcluir").bind("click", Excluir);
$(".btnAdicionar").bind("click", Adicionar);
}
function Salvar() {
}
function Editar() {
var par = $(this).parent().parent();
var tdNome = par.children("td:nth-child(1)");
var tdMnemonico = par.children("td:nth-child(2)");
var tdBotoes = par.children("td:nth-child(3)");
tdNome.html("<input type = 'text' id='txtNome' value='" + tdNome.html() + "'/>")
tdMnemonico.html("<input type = 'text' id='txtMnemonico' value='" + tdMnemonico.html() + "'/>")
tdBotoes.html("<img src = '/CeoScrum/Content/css/icone/icon_add.png' class = 'btnAdicionar'/><img src='/CeoScrum/Content/css/icone/icon_excluir.png' class='btnExcluir'/>");
$(".btnSalvar").bind("click", Salvar);
$(".btnEditar").bind("click", Editar);
$(".btnAdicionar").bind("click", Adicionar);
}
function Excluir() {
var par = $(this).parent().parent();
par.remove();
}
$(function () {
$(".btnEditar").bind("click", Editar);
$(".btnExcluir").bind("click", Excluir);
$("#btnAdicionar").bind("click", Adicionar);
});
</script>
}
@section ActionSection{
<input type="button" class="btn btn-primary" value="Salvar" onclick=" salvar();" />
<input type="button" class="btn btn-default" value="Voltar" onclick="redirectTo('@Url.Action("Listar", "Funcionalidade")')"/>
}
@using (Html.BeginForm((Model != null && Model.Id > 0 ? "Editar" : "Salvar"), "Funcionalidade", FormMethod.Post, new { @class = "form-horizontal", @id = "formFuncionalidade", @enctype = "multipart/form-data" })) {
<fieldset>
<div class="row">
<div class="col-sm-8">
<div style="text-align: left;">
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(c => c.Id, new { @class = "col-sm-2 control-label" })
<div class="col-sm-2">
@Html.TextBox("Id", "0", new { @id = "Id", @class = "form-control", @readonly = "readonly", @style = " margin-top: 8px;" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(c => c.Nome, new { @class = "col-sm-2 control-label" })
<div class="col-sm-6">
@Html.TextBoxFor(c => c.Nome, new { @id = "nome", @maxlength = 50, @class = "form-control", @placeholder = "Nome", @style = " margin-top: 8px;" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(c => c.Caminho, new { @class = "col-sm-2 control-label" })
<div class="col-sm-6">
@Html.TextBoxFor(c => c.Caminho, new { @id = "Caminho", @maxlength = 50, @class = "form-control",@placeholder = "Caminho", @style = " margin-top: 8px;" })
</div>
</div>
</div>
</div>
</div>
</fieldset>
<div class="col-sm-6">
<table id = "tbFuncionalidadeAcao" style = "width:100%" class="table table-striped table-bordered">
<tr>
<td style="text-align:center;">Nome</td>
<td style="text-align:center;">Mnemonico</td>
<td style="text-align:center;">Ação</td>
</tr>
<tr>
<td>
<input type="text" class="form-control date-picker" style="width:100%; text-align:center " name="dcMnemonico"
</td>
<td>
<input type="text" class="form-control date-picker" style="width:100%; text-align:center " name="dcAcao"
</td>
<td class="col-action">
<img id = "btnAdicionar"class="img-icon" src="/CeoScrum/Content/css/icone/icon_add.png" title="Editar registro" width="20px" />
</td>
</tr>
</table>
</div>
}