2011-10-14 3 views
6

MVC에서이 작품을 얻을 수있는 방법 Telerik Grid ControlMVC Telerik Grid 조건부 값?

 columns.Template(e => 
      { 
         if (e.EndDate>DateTime.Now) 
         { 
         @Html.ActionLink("Stop", "StopMedication", "Medication", 
          new { id = e.PrescriptionID }, new { @class = "standard button" }) 
         } 
         else { 
          @Html.ActionLink("Renew", "RenewMedication", "Medication", 
           new { id = e.PrescriptionID }, new { @class = "standard button" }) 
          } 
      }); 

답변

11

에서이 작업을 얻을 수 있습니다 현재 항목 (행에 연결된 엔터티)과 속성을 나타내는 @item 객체를 사용하면이 템플리트가 실행되어 실행될 수 있습니다.

+1

놀라운 답변입니다. 이것은 내가 몇 달 동안 어떻게해야 하는지를 알아 내려고 노력해 왔습니다. –

+0

안녕하세요, @ carlbergenhem, 대단히 감사합니다 .... –

+0

감사합니다 -이 솔루션은 잘 작동했습니다. – cyclical