I'm trying to render two tables via one model. I'm using my helper dll to create the tables. the problem is, I don't know how I can render only parts of my viewdata, at the first call of the page. here is some code:
Controller: (Creating two tables and the viewdata, returning the view, with model viewdata)
public class Controller1 : Controller {
//some code
public ActionResult Steuertabellen()
{
table = table_fill();
table= Tabelle.tabelleGenerieren(
table,
new Dictionary<string, SortierRichtung>(),
new List<string>(),
new List<string>()
);
table2 = table_fill();
table2 = Tabelle.tabelleGenerieren(
table2,
new Dictionary<string, SortierRichtung>(),
new List<string>()
);
VD_Planung_Prognosen viewdata = new VD_Planung_Prognosen();
viewdata.table= table;
viewdata.table2= table2;
return view(viewdata);
}
View:
@model namespace.Models.VD_Planung_Prognosen
@using namespace.Models;
<div class="tabelle_partialview" id="tabelle_partialview_@(tabellen2ID)">@{Html.RenderPartial("PV_table2", Model);}</div>
<div id="optionen_tabelle">
<div id="optionen_rechts">
<button class="btn_speichern btn_speichern_@(tabellenID)" id="btn_speichern">Speichern</button>
<button class="btn_abbrechen btn_abbrechen_@(tabellenID)" id="btn_abbrechen_@(tabellenID)">Abbrechen</button>
</div>
</div>
<div class="tabelle_partialview" id="tabelle_partialview_@(tabellenID)">@{Html.RenderPartial("PV_table", Model);}
PartialViews (edited):
@model namespace.Models.VD_Planung_Prognosen
@using HelperLib_Html.Tabelle.v1_02;
@{
@Html.createTabelle(Model.tabel1)
}
//<some style>
Edit I added the model (sry i should have done that before probably)
Model:
public class VD_Planung_Prognosen
{
public Matrix matrix { get; set; }
public Tabelle table1{ get; set; }
public Tabelle table2{ get; set; }
public List<stored_procedure1> years{ get; set; }
public List<stored_procedure2> groups{ get; set; }
public List<stored_procedure3> cost{ get; set; }
public List<stored_procedure4> costs2{ get; set; }
public List<stored_procedure5> data{ get; set; }
public int year{ get; set; }
public string grp{ get; set; }
public bool pflegeSteuertabellen { get; set; }
}
So this wont work, because the data presented in the actionlink above shows in one model, the two tables will follow each other, while the renderpartial shows one, then the buttons then the second. How can I use the model so that I can address only one table?
I hope my question is understandable, it seems quite comlicated to explain ;)
Thanks in advance
Daniel
Edit1: Of course the PV are created in the controller too, quite similar to the ActionLink view