Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在mvc中定制telerik网格中的弹出窗口_Asp.net_Asp.net Mvc - Fatal编程技术网

Asp.net 在mvc中定制telerik网格中的弹出窗口

Asp.net 在mvc中定制telerik网格中的弹出窗口,asp.net,asp.net-mvc,Asp.net,Asp.net Mvc,我必须在telerik网格中显示自定义弹出窗口,因为我无法显示网格中的所有值,所以当用户单击网格编辑按钮时,我需要根据特定的行数据键 从表中获取数据并在弹出窗口中显示这些记录,我想在用户单击网格按钮而不是我的签出按钮时打开该窗口,所以我能做什么 view <%@ Page Title="" Language="C#" MasterPageFile="~/Content/JobSeekers.Master" Inherits="System.Web.Mvc.ViewPage<IEnu

我必须在telerik网格中显示自定义弹出窗口,因为我无法显示网格中的所有值,所以当用户单击网格编辑按钮时,我需要根据特定的行数据键 从表中获取数据并在弹出窗口中显示这些记录,我想在用户单击网格按钮而不是我的签出按钮时打开该窗口,所以我能做什么

view

<%@ Page Title="" Language="C#" MasterPageFile="~/Content/JobSeekers.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ITClassifieds.ViewModels.workexperience>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    trial
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
    function onRowSelected(e) {
       var ordersGrid = $('#Grid').data('tGrid');
        var resexpid = e.row.cells[0].innerHTML;

        // update ui text
               $('#rexsepid').text(resexpid);
        // rebind the related grid
//        ordersGrid.rebind({
//            resexpid: resexpid
//        });
        var window = $("#Window").data("tWindow");
        window.center().open();




    }


        function closeWindow() {
            var window = $("#Window").data("tWindow");
            window.close();





            var undoButton = $('#undo');
            undoButton.show();
        }

        function openWindow() {
            var window = $("#Window").data("tWindow");
            window.center().open();
//            var ordersGrid = $('#Grid').data('tGrid');
//            var resexpid = ordersGrid.row.cells[0].innerHTML;

//            $('#rexsepid').text(resexpid);

//            alert(resexpid);



        }

        function viewDetails(activityId) {
            //....Do stuff here...

            alert(activityId);

        }




</script>

    <h2>trial</h2>
     <%=Html.Telerik().Grid(Model).Name("Grid").DataKeys(keys => keys.Add(m => m.resexpid))
      .Columns(columns=>

    {
        columns.Bound(m => m.resexpid).Width(100);
        columns.Bound(m => m.company).Width(100);
        //columns.Bound("Title").Width(100);
        columns.Bound(m=>m.title).Width(200);
        columns.Command(commands =>
            {
                commands.Edit().ButtonType(GridButtonType.Text);
                commands.Delete().ButtonType(GridButtonType.Text);
            }).Width(200).Title("Command");

        columns.Bound(m => m.resexpid).ClientTemplate("<a onclick='viewDetails('" + "'<#= Id #>'" + "');' href='javascript:'>View</a>").Title("View");

        //columns.Bound(m => m.Date).Width(200);
    })
     .ClientEvents(events => events.OnRowSelect("onRowSelected"))

        .DataBinding(dataBinding => 
        {


              dataBinding.Ajax()
                .Select("_FirstLook","Editresume")
                .Update("_SaveAjaxEditing", "Editresume")
                .Delete("_DeleteAjaxEditing", "Editresume");   


        })
        .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
        .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
        .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
        .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
        .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
        .Footer((bool)ViewData["showFooter"])

        .RowAction(row => row.Selected = row.DataItem.resexpid.Equals(ViewData["id"])) 

        %>
        <button class="button medium gray" onclick="openWindow()">Checkout</button> 

  <% Html.Telerik().Window()
           .Name("Window")
           .Title("Update Option")

           .Draggable(false)
           .Resizable(resizing => resizing
               .Enabled(true)
               .MinHeight(250)
               .MinWidth(250)
               .MaxHeight(500)
               .MaxWidth(500)
            )
           .Scrollable(true)
           .Modal(true)
           .Buttons(b => b.Maximize().Close())
           .Content(() =>
           {%>
           <div>

         <%--  <% %>
           <% if (ResumePackgeExits == true && JobPackageExist == true)
              {
              }
              else if (ResumePackgeExits == false && JobPackageExist == true)
              {
                %>--%>

           <div>

             <table border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;border:1px solid #AAA;margin:5px;">

                    <tr> <td colspan="3">
                    We Are also Provied a Unlimeted Resume Subscription.
                    if You Want a Resume Subscription Please click on RESUME Package button.
                    </td></tr>

             </table>
             <br />

           <%=Html.ActionLink("RESUME Package", "ResumePackage", null, new { @class = "button medium gray" })%>
           </div>

           <%--<%}else if(ResumePackgeExits == true && JobPackageExist == false) 
              {%>
--%>
              <div>
                    <table border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC" style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;border:1px solid #AAA;margin:5px;">

        <tr>
          <td colspan="3">
          We Are also Provied a Job Subscription.
                    if You Want a Job Subscription Please click on JOB Package button.
          </td>

        </tr>

      </table>
      <br />
       <%=Html.ActionLink("JOB Package", "jobpackage", null, new { @class = "button medium gray" })%>
              </div>

           <%--   <%} %>--%>
           <br />
<%--                <% using (Html.BeginForm("Checkout", "Package", FormMethod.Post, new { name = "frmDCC", onsubmit = "return CheckForm();" }))
                { %>
                   <input type="hidden" value="<%= Model.Total%>" name="totalPayment" />

                   <table>
                   <tr>
                   <td><%=Html.RadioButton("paymentoption","paypalPayment") %></td>
                   <td><img  src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal' /></td>
                   </tr>
                   <tr>
                   <td><%=Html.RadioButton("paymentoption","CreditCart") %></td>
                   <td> <img  src="https://www.paypal.com/en_US/i/bnr/horizontal_solution_PPeCheck.gif" border="0" alt="Check out with Credit Cart" /></td>
                   </tr>
                   </table>

                    <input type="submit" value="Go" name="submit" class="button medium gray" />

                <%} %>
               --%>


                </div>
           <%})
           .Width(500)
           .Height(400)
           .Visible(false)

           .Render();
    %>




</asp:Content>


controller


   public ActionResult trial()
        {
            //var re = (from j in db.Resumes
            //          select new
            //          Jobresults { JobTitle = j.JobTitle, Company = j.CompanyInfo }).AsEnumerable();
            var re = (from j in db.Resumes join res in db.Res_Exp on j.ResumeID equals res.Resume.ResumeID
                      where j.ResumeID == 258
                      select new workexperience {title=j.ResumeTitle,company=j.DesiredCompany ,resexpid=res.ResExpID}
                      ).AsEnumerable();




            ViewData["ajax"] = true;
            ViewData["scrolling"] = true;
            ViewData["paging"] = true;
            ViewData["filtering"] = true;
            ViewData["grouping"] = true;
            ViewData["sorting"] = true;
            ViewData["showFooter"] = true;
            return View(re);

        }

为了在telerik网格中定制弹出窗口,您需要利用编辑器模板。您将为viewmodel创建一个编辑器模板。brad wilson的教程将帮助您开始学习。telerik论坛上的帖子也可能对你有所帮助

telerik上的链接现在已经失效。如果任何人有关于它如何应用于Telerik MVC网格的具体信息,请分享。谢谢。