[RESOLVED]How can i pass data to another controller.

I have view which retrieves data from an Oracle database.I would like to edit a data in another controller.How can i pass that data to another controller.
For example:
The data at my home controller and it must be sent student controller to ActionResult edit method with FileNo.

  <div class="col-md-3">
     @Html.ActionLink("Edit","Edit","Ebebek", new { FileNo = item.FileNo }) 

You’re almost there

Actionlink’s overload looks like this:

@Html.ActionLink(string linkText, string ActionName, string ControllerName, object routeValues, object htmlAttributes)

So your link needs to look like:

@Html.ActionLink("Edit","Edit","Student", new { FileNo = item.FileNo }, null)

And your action within the "Student" controller would be:

public ActionResult Edit(int FileNo)


.How can i pass that data to another controller.

What kind of data it is? Session Data? Just an ID ? just a text? Application-wide data? Can be stored in a cookie?


And the fileno information doesn’t allow to retrieve what you want ie the basic approach is to just pass the id for the information you want to edit (for example showing a student grid and then you click on a link that pass the student id to show a detailed
edit view or whatever). Or what is the problem with this usual approach? You need to have two ids (ie fileno and studentid ?)

I bind to view from a dataset and all of data has a id now i’m trying to pass a data to another controller for edit it.

Let me you more clear. i wrote a query for retrieving data from several table at oracle database.I bind them to my homecontroller index view and it seems fine.Now second step is that i want to edit that data in another controller and save them another table
in oracle database. The data i told at the begining comes with just a fileno number there is no id but fileno is uniq key for all datas. So i think i have to use fileno right?

Is it possible to send a model to a controller method by using Actionlink ?

Leave a Reply