0

how can i post the form values using html.actionlink, don't want to use routes dictionary

<%=Html.ActionLink("Download", "MyFiles", "Jobs", null, new { @class = "cvclick" })%>

1
  • Your question makes no sense. Commented Jan 2, 2011 at 17:17

4 Answers 4

3

A link points to an HTTP GET request.
An HTTP GET request is sent to a URL; the URL must be defined using a route.

Sign up to request clarification or add additional context in comments.

Comments

2

To POST values you could use an HTML form:

<% using (Html.BeginForm("MyFiles", "Jobs")) { %>
    <%= Html.Hidden("key1", "value1") %>
    <%= Html.Hidden("key2", "value2") %>
    <input type="submit" value="Download" />
<% } %>

Comments

1

To POST values you could use Spark View Engine and a HTML form:

<form action="myfiles" controller="jobs">
  <hidden name="key1" value="value1" />
  <hidden name="key2" value="value2" />
  <submit title="Download" />
</form>

(The code uses some pretty standard bindings that be wired in Spark)

As for links and ActionLink. I would use the ajax helper instead since it can POST stuff. (Ajax.ActionLink)

Edit

So you want to DOWNLOAD a file? Well. The link should point on an action in your controller. The action should return a FileResult with your file. See here: http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.file(v=vs.90).aspx

2 Comments

using ajax.actionlink is there a way to return file
Nope. You gotto use forms to return files. but you can use a link (and the onclick attribute) to submit a form.
0

You can post the data using :-

anthing inside Beginform will be posted

<% using (Html.BeginForm("ActionName", "ControllerName"))
{ %>

 texbox code 

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

 <% } %>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.