Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC make action link perform a submit
    primarykey
    data
    text
    <p>I am currently trying to make an html submit occur, but using the MVC helper method ActionLink as I do not want it to be a button, I want it to be an underlined link like the rest on my page. This is what I have currently</p> <pre><code>&lt;%= Html.ActionLink("Delete Selected", "DeleteCheckBox", "Domains", "Default.aspx", new { type="submit" }) %&gt; </code></pre> <p>This jumps back to my action fine, but all the domains that are checked off to be deleted are not sent back. (if I use this, <code>&lt;input type="submit" name="DeleteAction" value="Delete" /&gt;</code> it works fine so I know it's not something wrong with submitting or retrieving the check boxes)</p> <p>Here's what I have so far ...</p> >" %> <p> Index </p> <p></p> <pre><code>&lt;h2&gt;Domain List&lt;/h2&gt; &lt;h2 style="color: #FF0000"&gt;&lt;%= Html.Encode(ViewData[IProwlAdminUI.Utils.Global.ExceptionMessageKey]) %&gt;&lt;/h2&gt; &lt;h2 style="color: #FF0000"&gt;&lt;%= Html.Encode(ViewData["Message"]) %&gt;&lt;/h2&gt; &lt;% using (Html.BeginForm("DeleteCheckBox", "Domains")) { %&gt; &lt;% if (ViewData.ContainsKey("DeleteMessage")) { %&gt; &lt;h2 style="color: #FF0000"&gt;&lt;%= Html.Encode(ViewData["DeleteMessage"]) %&gt;&lt;/h2&gt; &lt;input type="submit" name="DeleteAction" value="Commit" /&gt; &lt;input type="reset" name="DeleteAction" value="Cancel" /&gt; &lt;% } %&gt; &lt;p&gt; &lt;%= Html.ActionLink("Create New", "Create") %&gt; | &lt;%= Html.ActionLink("Export List", "Export") %&gt; | **&lt;a href="javascript:void(0)" class="DeleteLink"&gt;Delete Selected&lt;/a&gt;** &lt;% if (ViewData.ContainsKey("Path")) { %&gt; | &lt;%= Html.ReferenceToFile("/download/Domains.xls", "Exported File") %&gt; &lt;% } %&gt; &lt;/p&gt; &lt;div style="overflow:scroll; width:100%"&gt; &lt;% Html.Telerik().Grid(Model).Name("Domains") .DataKeys(dataKeys =&gt; dataKeys.Add(c =&gt; c.DomainId)).DataKeys(dataKeys =&gt; dataKeys.Add(c =&gt; c.Name)) .Columns(columns =&gt; { columns.Template(o =&gt; { %&gt; &lt;%= Html.ActionLink("Edit", "Edit", new { id = o.DomainId })%&gt; &lt;% }).Title("Edit"); columns.Template(o =&gt; { %&gt; &lt;% if (ViewData.ContainsKey("DeleteMessage")) { %&gt; &lt;input type='checkbox' checked="checked" id='&lt;%= o.Name %&gt;' name='DeleteIds' value='&lt;%= o.DomainId %&gt;' /&gt; &lt;% } %&gt; &lt;% else { %&gt; &lt;input type='checkbox' id='&lt;%= o.Name %&gt;' name='DeleteIds' value='&lt;%= o.DomainId %&gt;' /&gt; &lt;% } %&gt; &lt;% }).Title("Delete"); columns.Bound(o =&gt; o.DomainId); columns.Bound(o =&gt; o.Name); columns.Bound(o =&gt; o.SiteId); columns.Bound(o =&gt; o.ScrubAndRedirect); columns.Bound(o =&gt; o.ReportingSiteId); columns.Bound(o =&gt; o.TrafficCopClass); columns.Bound(o =&gt; o.SiteName); columns.Bound(o =&gt; o.FeedType); columns.Bound(o =&gt; o.Active); }).Sortable().Filterable().DataBinding(db =&gt; db.Server().Select("Index", "Domains")).Render();%&gt; &lt;/div&gt; &lt;% if (!ViewData.ContainsKey("DeleteMessage")) { %&gt; &lt;input type="submit" name="DeleteAction" value="Delete" /&gt; &lt;% } %&gt; &lt;% } %&gt; &lt;p&gt; &lt;%= Html.ActionLink("Create New", "Create") %&gt; | &lt;%= Html.ActionLink("Export List", "Export") %&gt; &lt;% if (ViewData.ContainsKey("Path")) { %&gt; | &lt;%= Html.ReferenceToFile("/download/Domains.xls", "Exported File") %&gt; &lt;% } %&gt; &lt;/p&gt; **&lt;script type="text/javascript"&gt; $(function() { $('.DeleteLink').click(function() { $(this).closest('form')[0].submit(); }); }); &lt;/script&gt;** </code></pre> <p></p>
    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.
 

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