Reload Window from Controller

2 posts, 1 answers
  1. Bob
    Bob avatar
    1 posts
    Member since:
    May 2015

    Posted 06 May 2015 Link to this post

    Greetings,

     I am new to Telerik's MVC controls and also to Jquery in general.  I am trying to build a wizard like interface for the attached screen shot using the Telerik window.  I can get the first step to load, but when click either of the buttons to load the new view for step 2, nothing happens.  The controller fires correctly.    It seems like I need to somehow refresh or reload the Telerik window, but I am not sure how to to do this.  Any help would be much appreciated.

     

     View

    @{
        ViewBag.Title = "AddCampaignStep1";
        Layout = "~/Views/Shared/_LayoutModal.cshtml";
    }
     
        <script type="text/javascript">
            function SaveandExit() {
                var itemId = $('#btnSaveandExit').attr('itemid');
                var url = '@Url.Action("AddCampaignStep1", "AgencyCampaign")';
              var data = { Id:itemId };
              $.post(url, data, function (result) {
                  var id = '#postedFor' + postId;
                  $(id).html(result);
              });
     
     
            }
            function SaveandContinue() {
     
                var itemId = $('#btnSaveandContinue').attr('itemid');
                var url = '@Url.Action("AddCampaignStep1", "AgencyCampaign")';
                var data = { Id: itemId };
                $.post(url, data, function (result) {
                    var id = '#postedFor' + postId;
                    $(id).html(result);
     
                });
            }
      </script>
     
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        <h4 class="modal-title" id="addCampaignModalLabel">Add New Campaign</h4>
            <div class="center">
                <img src="~/Content/img/progress-add_campaign-step1.png">
            </div>
            <fieldset>
                <div class="form-group">
                    <label for="inputCampaingName" class="control-label">Campaign Name:</label>
                    <input type="text" name="inputCampaingName" id="inputCampaingName" class="form-control" value="">
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" name="inputCampaingEndsNotification" id="inputCampaingEndsNotification"> Email me when campaign ends
                    </label>
                </div>
            </fieldset>
        <input id="btnSaveandExit" itemid="0" type="button" onclick="SaveandExit()" class="btn btn-default" value="Save and Exit"/>
        <input id="btnSaveandContinue" itemid="1" type="button" onclick="SaveandContinue()" class="btn btn-primary modal-btn" value="Save and Continue" />
      
     
    }

     Controller

    public ActionResult AddCampaignStep1(int id)
         {
           return View("AddCampaignStep2");   //this line fires with the correct id
       
         

  2. Answer
    Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 08 May 2015 Link to this post

    Hello Bob,

    You can call the window refresh method to refresh its content. This will trigger a request to the partial view that the window shows. If this is not what you need, please elaborate.

    Regards,
    Alex Gyoshev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top