109221793
109221793

Reputation: 16897

MVC5 Form won't post; submit button does nothing

We are in the process of redesigning the UI in our ASP.NET MVC 5 web application. We're moving to the bootstrap framework, and finally making the switch from aspx views to razor views.

I have this form -

@using(Html.BeginForm("Dashboard", "Reports")) {
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">Select date ranges & display currency</h4>
        </div>
        <div class="panel-body">
            <div class="row">
                <div class="col-md-3">
                    <label for="reportRequest_FromDate" class="control-label">Month:</label>
                    <div class="form-group">
                        @Html.TextBoxFor(t => t.reportRequest.FromDate, new { @class = "form-control"})
                    </div>
                </div>
                <div class="col-md-3">
                    <label for="reportRequest_CompareFromDate" class="control-label">Compare:</label>
                    <div class="form-group">
                        @Html.TextBoxFor(t => t.reportRequest.CompareFromDate, new { @class = "form-control"})
                    </div>
                </div>
                <div class="col-md-3">
                    <label>Currency:</label>
                    <div class="form-group">
                        @Html.DropDownListFor(t => t.reportRequest.Currency,Html.GetBaseCurrency(), new { @class = "form-control"})
                    </div>
                </div>
                <div class="col-md-3 pull-right">
                    <br />
                    <button type="submit" class="btn btn-primary btn-lg"><span class="fa fa-fw fa-bar-chart-o"></span> Display Report</button>
                </div>
            </div>
        </div>
    </div>
}   

Here I select a two months (a default month, and another month for comparison), and a currency.

Clicking on the Submit button does absolutely nothing. I have tried changing it to a simple -

<input type="submit" value="Submit" />

to see if this was my issue, but the behaviour was the same.

This strikes me as something simple, but after web searching I've come up blank. I'm probably not using the right terms to search. Can anyone see if there's anything I'm missing here?

Thanks.

Upvotes: 1

Views: 6035

Answers (1)

Anupam Singh
Anupam Singh

Reputation: 1166

You might want to post data using this, try this overloaded version of BeginForm method

@using(Html.BeginForm("Dashboard", "Reports",FormMethod.Post,null)) 

Hope will help.

Upvotes: 1

Related Questions