Sunday, 15 January 2012

c# - Make a View partial -



c# - Make a View partial -

i have view called drawgraph , accessed through controller via;

@html.actionlink("drawgraph", "drawgraph", new {id =item.data})

when utilize link page loads on new page (as would) display part of page link on, there easy way achive this?

my controller looks this;

public actionresult drawgraph(string data) { *bunch of code homecoming view(chart); }

yes can, need utilize ajax, luckily asp.net mvc provides nice convenience methods ajax.actionlink

@ajax.actionlink("drawgraph", "drawgraph", new {id =item.data}, new ajaxoptions { updatetargetid = "yourdiv", insertionmode = insertionmode.replace, }) <div id="yourdiv"> </div>

then need homecoming partial view action partialview:

public actionresult drawgraph(string data) { //bunch of code homecoming partialview(chart); }

you should not forget include jquery.unobtrusive-ajax.min.js in layout/view in order ajax helpers work.

c# asp.net-mvc asp.net-mvc-3

No comments:

Post a Comment