Pass data between views (Without Entity Framework)

0

I have a form that in a field has a button, that button opens another view where I have a list of X number of elements. What I want to do is that when I open that second view I select an item from the list and that selection is passed to the textbox of the first view. I'll be grateful if you could help me how to do this.

    
asked by Jesus Galeano 15.11.2016 в 16:56
source

3 answers

1

This article can help you How to pass data between pages in asp.net link

Although you are using MVC the idea is the same. You can serve point 4 of the article. But if you need that modal that you mention doing operations on the server, you have to think about loading via ajax the modal ... If it is the boostrap mode or you are using angulat ... We could have better architectures of data passage and modal opening (since everything is in view)

I hope it will help or guide you

    
answered by 24.12.2016 в 13:04
-1

You can use Session or TempData to store the info you require

    
answered by 15.11.2016 в 17:10
-1

Create a function. For example:

function AsignarValor(cantidad) {
    $("#codigo123").val(cantidad);
}

<a href="#" data-dismiss="modal" onclick="AsignarValor('@(item("cantidad").ToString.Trim)')">Ver</a>

simplify the code that I generate from a dynamic table that I fill depending on a combo.

<input id="codigo123" type="text" />
    
answered by 15.11.2016 в 17:53