1

I have a view that looks like this: http://whatever/Download/viaId/12345

And i would like to call the action

public void viaId (int Id)
{
    //Code 
}

when the page loads. Right now I only have the controller implemented and when I browse the url the parameter Id is null.

Do i need to create the view and call it through javascript ?

1
  • Ok i got it solved. I did not have the parameter mapped on the RouteCollection. thanks for your suggestions Commented Jul 1, 2009 at 15:37

3 Answers 3

1

Ok i got it solved. I did not have the parameter mapped on the RouteCollection. thanks for your suggestions

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

Comments

0

It sounds like you don't have a view, you just have a URL and an action.

You should create a view called "viaId" for your Controller to give to the user. The easiest way to do this is to right click on the action and click "Add View" (assuming you're using Visual Studio).

Additionally, the viaId method should probably return ActionResult instead of void.

Comments

0

I think you just need to add the attribute

[AcceptVerbs(HttpVerbs.Get)] 

public void viaId(int id) {}

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.