0

Suppose VIEW has this variable

@{
    ViewBag.Title = "carganuevamente";
    int ventaid = (Model.Venta == null ? 0 : Model.Venta.id);
}

then you open a partial view

@Html.Partial("selectcliente", Model.ListadoClientes);

how can I updata this variable since my partialview?

tereško
  • 58,060
  • 25
  • 98
  • 150
angel
  • 4,474
  • 12
  • 57
  • 89
  • 2
    What are you actually trying to do? `ventaid` is a server side variable. Once the view is rendered it no longer exists. –  Jun 24 '15 at 03:33
  • In view (parent) i have a object in null, which it has value when partial view is closed, but not all page refresh, then ( i believe) the object in parent view stay in null – angel Jun 24 '15 at 14:08

1 Answers1

0

You have different options:

  1. Send ajax request and overwrite this variable with response data
  2. Use global variables that you can access anywhere in project
  3. Pass it to partial as model
  4. Use viewbag or other collections

See more information here:

How can I pass parameters to a partial view in mvc 4

Community
  • 1
  • 1
Fabjan
  • 13,506
  • 4
  • 25
  • 52