Note that there are some explanatory texts on larger screens.

plurals
  1. POpage number click in webgrid calls controller action with pagenumber as input
    primarykey
    data
    text
    <p>I have below piece of code. Whenever I click on upload button, the file submits. If there is an error, then it will be displayed in the grid. But, when I click on A page number, then the controller action, "Upload," gets called with the page number as the input. Also, when I click on the column name for sorting, then the controller action "Upload" gets called with sort=columnname and sortDIR=ASC parameters.</p> <p>I want to prevent these controller action calls.</p> <p>In Controller:</p> <pre><code>[HttpPost] public ActionResult Upload(HttpPostedFileBase fileUpload) { } </code></pre> <p>In Design:</p> <pre><code>@using (Html.BeginForm("Upload", "FileUpload", FormMethod.Post, new { enctype = "multipart/form-data" })) { &lt;input type="file" name="fileUpload" size="35" id="fileupload"/&gt; &lt;br /&gt; &lt;br /&gt; &lt;span class="button"&gt; &lt;input type="submit" class="form_button" value="Upload" id="btnUpload" /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span class="button"&gt; &lt;input type="reset" id="btnCancel" value="Cancel" name="Cancelbutton" class="form_button" /&gt; &lt;/span&gt; &lt;div id="progressbardiv" style="display:none; font-size:medium;"&gt; &lt;img src="../../Images2/ajax-loader.gif"/&gt;Uploading File... &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; } @if (Model.lstError != null) { &lt;div id="grid"&gt; @{ var grid = new WebGrid(source: Model.lstError, canSort: true, rowsPerPage: 10 ); } @grid.GetHtml( tableStyle: "webGrid", headerStyle: "gridHead", alternatingRowStyle: "alt", columns: grid.Columns( grid.Column("RowId", header: "Sr.No"), grid.Column("EmployeeID", header: "Emp Id"), grid.Column("ApplicantID", header: "Candidate Id"), grid.Column("EmployeeName", header: "Employee Name"), grid.Column("Message", header: "Message") ) ) &lt;/div&gt; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload