I have in my MVC view..
//Submit file
<% using (Html.BeginForm("MethodName","ControllerName", FormMethod.Post, new { enctype = "multipart/form-data"})) { %>
<input type="file" name="file" id="file"/>
<input type="text" id="file-name" name="Id"/>
<input type="submit" value="Submit" name="Submit"/>
<% } %>
//Save link.
<span class="Update" onclick="js.function()">Update</span>
Once I click on the Submit button, I go to controller and the method to run some code that submits the file to the database. After that is finished, I need to auto-click/force click the save link so that the js function is run after the submit .. how can I do that.
I would use Ajax.BeginForm and in the OnSuccess handler you can click the button. Your code would look something like this (not tested but should lead you in the right direction):
Javascript:
Edit: If you were not trying to upload a file my above answer would be what you want. However, I have looked into this a little more as I noticed you were trying to post a file; and you cannot upload files using ajax without using html 5, iframe hacks, etc. It appears to me that your best bet would be to use an uploader such uploadify or plupload that resolve this issue using html5, flash, or hacks based on how you set them up.
Also, binding-httppostedfilebase-using-ajax-beginform is a similar question that has something that may be of help.