Reload Window from Controller

1 Answer 2021 Views
Window
Bob
Top achievements
Rank 1
Bob asked on 06 May 2015, 06:54 PM

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
   
     

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 08 May 2015, 02:54 PM

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.

 
Tags
Window
Asked by
Bob
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or