0

그리드의 버튼 클릭 이벤트에서 선택한 행의 PreEmploymentId를 그리드에서 창으로 전달하는 방법은 무엇입니까? 이것은 간단할지 모르지만 나는 새롭고 여전히 기초를 배우고 있습니다.검도 그리드에서 MVC의 검도 창으로 값을 전달하는 방법

는 스크립트

<script> 
    $("[data-button-type='auction']") 
       .click(function(e) { 
        myWindow.data("kendoWindow").open(); 
        myWindow.data("kendoWindow").center(); 
        myWindow.data("kendoWindow").top(); 
       }); 
</script> 

검도 그리드 -

<div > 
@*Telerik grid*@ 
@{ 
    Html.Kendo().Grid(Model.LstPreEmploymentWorkflowModellist) 
     .Name("MyGrid") 
     .Columns(col => 
     { 
      //on edir button click action name Main in invoked in PreEmploymentWorkflow controller and PreEmploymentId is passed 
      col.Template(@<text> 
          @Html.ActionLink("Edit", "Main", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId}, new {@class = "classname"})</text>).Width(30); 
      col.Bound(o => o.PreEmploymentId).Visible(false).Groupable(false); 
      col.Bound(o => o.FirstName).Width(30).Groupable(false); 
      col.Template(@<text> 
          @Html.ActionLink("OpenFile", "Openfile", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId, uploadfilename = "EEOC Tracking Form"}, new {@class = "classname3"})</text>).Title("EEOC").Width(30); 
      col.Template(@<text>@(Html.Kendo().Button() 
             .Name("open" + @item.PreEmploymentId) 
             .ImageUrl(Url.Content("/images/auction_16.gif")).HtmlAttributes(new {type = "submit", data_button_type = "auction" }) 
            ) 
          </text>).Width(40).Title("Status"); 
      col.Template(@<text> 
          @Html.ActionLink("Delete", "Delete", "PreEmploymentWorkflow", new {Id = item.PreEmploymentId}, new {@class = "classname2"})</text>).Width(30); 
     }) 
     //.HtmlAttributes(new { style = "width: 1100px" }) 
     .Sortable() 
     .Render(); 
} 

검도 창 - 사전에

@{Html.Kendo().Window() 
     .Name("window") 
     .Width(500) 
     .Height(315) 
     .Animation(true) 
     .Draggable() 
     .Visible(false) 
     .Modal(true) 
     .Title("Employment Status") 
     .Actions(actions => actions.Close()) 
     .Content(@<text> 
        @using (Html.BeginForm("CreateStatus", "PreEmploymentWorkflow", FormMethod.Post, new { enctype = "multipart/form-data" })) 
        { 
         <table> 
          <tr> 
          <td> 
            @(Html.Kendo().TextBoxFor(m => m.LstPreEmploymentWorkflowModel.PreEmploymentId)) 
           </td> 
           <td> 
            @(Html.Kendo().RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(1).Label("Approved")) 
           </td> 
           <td> 
            @(Html.Kendo().RadioButtonFor(m => m.LstPreEmploymentWorkflowModel.Status).Value(9).Label("Reject")) 
           </td> 
          </tr> 
          <tr> 
           <td> 
            <label class="Bold" for="statusattachment">Status Attachment:</label> 
           </td> 
           <td><input type="file" name="uploadfilestatus"/></td> 
          </tr> 
          <tr> 
           <td> 
            <input id="Button1" type="submit" value="Submit"/> 
           </td> 
          </tr> 
         </table> 
        } 
       </text>) 
     .Render(); 
} 

감사합니다.

답변

0

사람이 검색되는 경우, 수행하는 방법에

검도 그리드에서
<script> 

function editItem(e) { 
    e.preventDefault(); 
    var dataItem = this.dataItem($(e.currentTarget).closest("tr")); 
    var pId = dataItem.PreEmploymentId; 


     var myWin = $("#windowstatus").kendoWindow({ 

     modal: true, 
     width: "450px", 
     height: "250px", 
     resizable: true, 
     position: { 
      top: 400, 
      left: 650 
     }, 
     title: "PreEmployment Status", 
     content: { 
      url: "../StatusWindow", //controller name 
      data: { customerId: pId } //passing data 
     } 

    }); 
    myWin.data("kendoWindow").open(); 
    return false; 
} 
</script> 

<script type="text/x-kendo-template" id="template"> 
    <div id="details-container"> 

    </div> 
</script> 

,

col.Bound(o => o.PreEmploymentId).Visible(false).Groupable(false); 
    col.Command(command => command.Custom("Change Status").Click("editItem")).Width("120px"); 

StatusWindowController에서,

public class StatusWindowController : Controller 
    { 
     // GET: StatusWindow 
     public ActionResult Index(int customerId) 
     { 

      return View(mixstatus); 
     } 
    } 
0

이 데모는 보여줍니다 정확히 :

http://demos.telerik.com/aspnet-mvc/grid/custom-command

+0

답장을 보내 주셔서 감사합니다. 나는 주어진대로 시도했지만 html 형식으로 제공됩니다. 모델의 객체로 사용하여 데이터베이스에 삽입하기 위해 버튼 클릭 이벤트에 값을 전달할 수 있기를 바랍니다. – Swapnil

관련 문제