0

I have a page in my .Net MVC project that calls a pop up using javascript. Now I need to send a property that I get from my model over to the actionresult so that I can work with it.

What my page looks like

<script type="text/javascript">
//function print() {
//    $(".btnPrint").printPage();

ShowPopUp = function () {
    window.showModalDialog("/FileUpload/GetPopupData/ --Pass my Model property, what to do? --", "wndPopUp", "width=300,height=500");
} 

My Action Result where I want to use the property

public ActionResult GetPopupData(int consignmentId)
    {
        var test = consignmentId;
        //Call the pop up view and populate it accordingly
        return new GetDocumentTypeAction<ActionResult>
        {
            OnLoaded = m => View("../../Areas/Exports/Views/FileUpload/FileUpload", m),
            OnErrorOccured = (m) => Redirects.ToErrorPage()
        }.Execute(GtsClient);
    }
tereško
  • 58,060
  • 25
  • 98
  • 150
JcMey3r
  • 181
  • 2
  • 14
  • 1
    check this link and avoid using http://stackoverflow.com/questions/728196/window-showmodaldialog-vs-window-open – neel shah Mar 20 '14 at 09:54

1 Answers1

1

Try a querystring:

"/FileUpload/GetPopupData?consignmentId=" + '@Model.ConsignmentId'

Just make sure that the property names match the method signature for the given action.

Bill
  • 1,431
  • 10
  • 13