2016-02-15 4 views
0

Я использую визуальную студию 2012 и mvc4.Как перенаправить просмотр в отдельном окне цели

Я хочу открыть CertDet вида в отдельном окне

В индексном я использовал представить с помощью метода поста.

My Controller -

[HttpPost] 
    [AllowAnonymous] 
    public ActionResult Index(ModelCertificate cert) 
    { 
     if (ModelState.IsValid) 
     { 

      dbRTCEntities objCon = new dbRTCEntities(); 
      Mst_Catref data = objCon.Mst_Catref.Where(x => x.Catref == cert.Catref).FirstOrDefault(); 

      if (data != null) 
      { 
       return RedirectToAction("CertDet", new { catref = data.Catref, Excise = cert.ExciseNumber, customerNm = cert.CustomerName });      
      } 
      else 
       ModelState.AddModelError("", "Catref not found"); 
     } 

     return View(); 
    } 

    public ActionResult CertDet(string catref, string Excise, string customerNm) 
    { 
     dbRTCEntities objCon = new dbRTCEntities(); 
     Mst_Catref data = objCon.Mst_Catref.Where(x => x.Catref == catref).FirstOrDefault(); 
     ModelCertificate cert = new ModelCertificate(); 

     return View(cert); 
    } 
+1

Вы также можете показать свое мнение .. – Vini

ответ

0

Вы должны что-то нужно, как это на ваш взгляд:

@Html.ActionLink("CertDet", "CertDet", new { catref = data.Catref, Excise = cert.ExciseNumber, customerNm = cert.CustomerName }, new {target = "_blank"}) 

Это сделает что-то подобное в новом окне;

<a href="/CertDet/?certref=xyz&Excise=abc&customerNm=123" target="_blank">CertDet</a> 
Смежные вопросы