Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:15:57+00:00 2026-06-15T21:15:57+00:00

I am using MVC 3 and Razor, attempting to post a form back to

  • 0

I am using MVC 3 and Razor, attempting to post a form back to a controller from a telerik window (telerik.window.create) that loads a partial view. Im not sure how to post this so ill just post the code in order of execution and explain it as I go.

First an anchor is clicked, and onClick calls:

    function showScheduleWindow(action, configId) {
    var onCloseAjaxWindow = function () { var grid = $("#SubscriptionGrid").data("tGrid"); if (grid) { grid.rebind(); } };
    CreateAjaxWindow("Create Schedule", true, false, 420, 305, "/FiscalSchedule/" + action + "/" + configId, onCloseAjaxWindow);
}

And the CrateAjaxWindow method:

function CreateAjaxWindow(title, modal, rezible, width, height, url, fOnClose) {
    var lookupWindow = $.telerik.window.create({
        title: title,
        modal: modal,
        rezible: rezible,
        width: width,
        height: height,
        onClose: function (e) {
            e.preventDefault();
            lookupWindow.data('tWindow').destroy();
            fOnClose();
        }
    });

    lookupWindow.data('tWindow').ajaxRequest(url);
    lookupWindow.data('tWindow').center().open();
}

Here is the partial view that is being loaded:

@model WTC.StatementAutomation.Web.Models.FiscalScheduleViewModel
@using WTC.StatementAutomation.Model
@using WTC.StatementAutomation.Web.Extensions           

@using (Html.BeginForm("Create", "FiscalSchedule", FormMethod.Post, new { id = "FiscalScheduleConfigForm" }))
{
    <div id="FiscalScheduleConfigForm" class="stylized">
        <div class="top">
            <div class="padding">
                Using fiscal year end: @Model.FiscalYearEnd.ToString("MM/dd")
            </div>
            <div class="padding Period">
                <table border="0">
                    <tr>
                        <th style="width: 120px;"></th>                   
                        <th>Effective Date</th>
                        <th>Next Run</th>
                        <th>Start From Previous</th>
                    </tr>
                    <tr>
                        <td>
                            @Html.CheckBoxFor(m => m.HasMonthly)
                            <label>Monthly</label>
                        </td>
                        <td>
                            @{ var month = Model.GetForFiscalPeriod(FiscalPeriodStatementSchedule.FiscalPeriod.Monthly);}
                            @month.BaseSchedule.StartDate.ToString("MM/01/yyyy")
                        </td>
                        <td>
                            @month.BaseSchedule.NextScheduleRun.ToString("MM/dd/yyyy")
                        </td>
                        <td class="previous">
                            @(month.HasRun ? Html.CheckBoxFor(m => month.BaseSchedule.StartFromPreviousCycle, new { @disabled = "disabled", @readonly = "readonly" }) : Html.CheckBoxFor(m => month.BaseSchedule.StartFromPreviousCycle))    
                        </td>
                    </tr>
                     <tr>
                        <td>
                             @Html.CheckBoxFor(m => m.HasQuarterly)  Quarterly
                        </td>
                        <td>
                            @{ var quarter = Model.GetForFiscalPeriod(FiscalPeriodStatementSchedule.FiscalPeriod.Quarterly);}
                            @quarter.BaseSchedule.StartDate.ToString("MM/01/yyyy")
                        </td>
                        <td>
                            @quarter.BaseSchedule.NextScheduleRun.ToString("MM/dd/yyyy")
                        </td>
                        <td class="previous">
                            @(quarter.HasRun ? Html.CheckBoxFor(m => quarter.BaseSchedule.StartFromPreviousCycle, new { @disabled = "disabled", @readonly = "readonly" }) : Html.CheckBoxFor(m => quarter.BaseSchedule.StartFromPreviousCycle))    
                        </td >
                    </tr>   
                    <tr>
                        <td>
                             @Html.CheckBoxFor(m => m.HasAnnual) Annual
                        </td>
                        <td>
                            @{ var annual = Model.GetForFiscalPeriod(FiscalPeriodStatementSchedule.FiscalPeriod.Annual);}
                            @annual.BaseSchedule.StartDate.ToString("MM/01/yyyy")
                        </td>
                        <td>
                            @annual.BaseSchedule.NextScheduleRun.ToString("MM/dd/yyyy")
                        </td>
                        <td class="previous">

                            @(annual.HasRun ? Html.CheckBoxFor(m => annual.BaseSchedule.StartFromPreviousCycle, new { @disabled = "disabled", @readonly = "readonly" }) : Html.CheckBoxFor(m => annual.BaseSchedule.StartFromPreviousCycle))    
                        </td>
                    </tr>   
                    <tr>
                        <td>
                             @Html.CheckBoxFor(m => m.HasSemiAnnual) Semi-annual
                        </td>
                        <td>
                            @{ var semi = Model.GetForFiscalPeriod(FiscalPeriodStatementSchedule.FiscalPeriod.SemiAnnual);}
                            @semi.BaseSchedule.StartDate.ToString("MM/01/yyyy")
                        </td>
                        <td>
                            @semi.BaseSchedule.NextScheduleRun.ToString("MM/dd/yyyy")
                        </td>
                        <td class="previous">

                            @(semi.HasRun ? Html.CheckBoxFor(m => semi.BaseSchedule.StartFromPreviousCycle, new { @disabled = "disabled", @readonly = "readonly" }) : Html.CheckBoxFor(m => semi.BaseSchedule.StartFromPreviousCycle))    

                        </td>
                    </tr>     
                </table>
            </div>
            <div class="padding StartDay">
                <span>Run on day:</span>
                @Html.TextBoxFor(model => model.StartDay)
                <span>of every period.</span>
            </div>
        </div>
        <div class="bottom">
            <div class="padding">
                <div style="float: left;">
                    @if (Model.ShowSuccessSave)
                    {
                        <div id="successSave" class="label">Changes saved succesfully</div>
                    }
                    @Html.ValidationSummary(true)
                    @Html.HiddenFor(x => x.SubscriptionId)
                    @Html.HiddenFor(x => x.DeliveryConfigurationId)
                    @Html.HiddenFor(x => x.FiscalYearEnd)   
                </div>
                <a id="saveSchedule" class="btn" href="">Save</a>
            </div>
        </div>
    </div>
}

<script type="text/javascript">
    $(function () {
        $('a#saveSchedule').click(function () {
            $(this).closest("form").submit();
            return false;
        });
    });
</script>

And finally the controller method:

[HttpPost]
public ActionResult Create(FormCollection formValues, int subscriptionId, int deliveryConfigurationId, int startDay, DateTime fiscalYearEnd)
{

    if (ModelState.IsValid)
    {

        var selectedSchedules = GetCheckedSchedulesFromForm(formValues);
        var startFromPrevious = GetFromPreviouSelections(formValues);
        this.AddModelErrors(_fiscalScheduleService.AddUpdateSchedules(selectedSchedules, subscriptionId, deliveryConfigurationId, startDay, startFromPrevious));            
    }


    return new RenderJsonResult { Result = new { success = true, action = ModelState.IsValid ? "success" : "showErrors", 
                                  message = this.RenderPartialViewToString("_FiscalScheduleConfigForm", 
                                  BuildResultViewModel(deliveryConfigurationId, subscriptionId, fiscalYearEnd, ModelState.IsValid)) } };                        

}

As you can see I am using jQuery to post back to the controller, which I have done on several occasions in the applicaiton, this seems to work fine normally. But with this form, for some reason it is not posting back or stepping into the Create method at all. I am speculating that it has something to do with the parameters on the controller method. But I am fairly new to MVC (coming from ASP.NET world) so Im not really sure what I am doing wrong here. Any help would be greately appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:15:58+00:00Added an answer on June 15, 2026 at 9:15 pm

    I was able to get it to post to the controller by modifying the textboxfor for the startDay:

    Changed from:

    @Html.TextBoxFor(model => model.StartDay)
    

    To:

    @Html.TextBoxFor(model => model.StartDay, new { id = "startDay" }) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Telerik Date Picker for ASP.Net MVC Razor Form. In this form
I'm attempting to upgrade an MVC project to Beta using Razor (from the Preview
Using a Telerik Grid with ASP.NET MVC 3 Razor engine. When a user selects
I am using Ajax.Begin Form in my MVC 3 + Razor application using (Ajax.BeginForm(ActionName,
Using jqGrid in mvc razor I want a class that can go for jqGrid
I am using jquery UI Tab in my asp.net MVC(RAZOR) application. Issue that i
When using MVC Razor you often write @Url.Content(~/images/someimage.png) and you get intellisense on that
I have a project that I am developing using MVC 3 using Razor views.
I'm using ASP.NET MVC 3 with Razor views. When you want to create a
In my MVC 3 Razor application, an ActionResult Create() method in the Controller handles

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.