I am currently trying to make an html submit, but using the MVC ActionLink helper method, since I don't want this to be a button, I want it to be an underlined link, like the others on my page. This is what I have now
<%= Html.ActionLink("Delete Selected", "DeleteCheckBox", "Domains", "Default.aspx", new { type="submit" }) %>
This goes back to my action, but all domains that were deleted for deletion are not sent back. (if I use this, <input type="submit" name="DeleteAction" value="Delete" /> it works fine, so I know that this is not something wrong with sending or retrieving checkboxes)
Here is what I still have ...
> "%>
Index
<h2>Domain List</h2> <h2 style="color: #FF0000"><%= Html.Encode(ViewData[IProwlAdminUI.Utils.Global.ExceptionMessageKey]) %></h2> <h2 style="color: #FF0000"><%= Html.Encode(ViewData["Message"]) %></h2> <% using (Html.BeginForm("DeleteCheckBox", "Domains")) { %> <% if (ViewData.ContainsKey("DeleteMessage")) { %> <h2 style="color: #FF0000"><%= Html.Encode(ViewData["DeleteMessage"]) %></h2> <input type="submit" name="DeleteAction" value="Commit" /> <input type="reset" name="DeleteAction" value="Cancel" /> <% } %> <p> <%= Html.ActionLink("Create New", "Create") %> | <%= Html.ActionLink("Export List", "Export") %> | **<a href="javascript:void(0)" class="DeleteLink">Delete Selected</a>** <% if (ViewData.ContainsKey("Path")) { %> | <%= Html.ReferenceToFile("/download/Domains.xls", "Exported File") %> <% } %> </p> <div style="overflow:scroll; width:100%"> <% Html.Telerik().Grid(Model).Name("Domains") .DataKeys(dataKeys => dataKeys.Add(c => c.DomainId)).DataKeys(dataKeys => dataKeys.Add(c => c.Name)) .Columns(columns => { columns.Template(o => { %> <%= Html.ActionLink("Edit", "Edit", new { id = o.DomainId })%> <% }).Title("Edit"); columns.Template(o => { %> <% if (ViewData.ContainsKey("DeleteMessage")) { %> <input type='checkbox' checked="checked" id='<%= o.Name %>' name='DeleteIds' value='<%= o.DomainId %>' /> <% } %> <% else { %> <input type='checkbox' id='<%= o.Name %>' name='DeleteIds' value='<%= o.DomainId %>' /> <% } %> <% }).Title("Delete"); columns.Bound(o => o.DomainId); columns.Bound(o => o.Name); columns.Bound(o => o.SiteId); columns.Bound(o => o.ScrubAndRedirect); columns.Bound(o => o.ReportingSiteId); columns.Bound(o => o.TrafficCopClass); columns.Bound(o => o.SiteName); columns.Bound(o => o.FeedType); columns.Bound(o => o.Active); }).Sortable().Filterable().DataBinding(db => db.Server().Select("Index", "Domains")).Render();%> </div> <% if (!ViewData.ContainsKey("DeleteMessage")) { %> <input type="submit" name="DeleteAction" value="Delete" /> <% } %> <% } %> <p> <%= Html.ActionLink("Create New", "Create") %> | <%= Html.ActionLink("Export List", "Export") %> <% if (ViewData.ContainsKey("Path")) { %> | <%= Html.ReferenceToFile("/download/Domains.xls", "Exported File") %> <% } %> </p> **<script type="text/javascript"> $(function() { $('.DeleteLink').click(function() { $(this).closest('form')[0].submit(); }); }); </script>**
c # asp.net-mvc actionlink
DMan Aug 10 '10 at 2:05 p.m. 2010-08-10 14:05
source share