Stay with input text filled after changing view Asp.net

Asked

Viewed 25 times

0

I’m in the following situation

I have a view with a certain field, when clicking a button it calls a certain view, it would need that when clicking a button of that other view, it called this original view with the form filled as it was.

I thought that if by saving what was filled before, and clicking on the button of this other view, would appear the filled field, only that is coming vázio.

script

var descricao;
$('body').on('click', '#btnNovaAreaReclamacao', function () {
    descricao = $("#Descricao").val();
});

$('#btnSalvarNovaAreaReclamacao').on('click', function () {
    $("#Descricao").val(descricao);
    console.log(descricao);
});

html from the second view

<body>
    <div>
        <p>
            <a href="#" class="btn btn-success" id="btnSalvarNovaAreaReclamacao" data-action="Create" data-toggle='tooltip' data-placement='top' title='Cadastrar'>
                <span class="glyphicon glyphicon-plus"></span>
                Nova
            </a>
        </p>
    </div>
</body>

When I put for example, it works by clicking on the description field but it’s not the effect I need

//nome do campo que eu estou usando
$('#Descricao').on('click', function () {
    $("#Descricao").val(descricao);
    console.log(descricao);
});

I also tried to

$('body').on('click', 'btnSalvarNovaAreaReclamacao', function () {
    $("#Descricao").val(descricao);
    console.log(descricao);
});

How to do to click the button it load this data correctly?

1 answer

0

I found the solution:

$(window).load('btnSalvarNovaAreaReclamacao', function () {

});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.