user471317
user471317

Reputation: 1231

Return partial html from a partial view?

We have a page which has quite a few (close to 20) buttons/links that will popup different divs. I am thinking of having the html for all these 20 divs in one cshtml file. When an ajax call is made ( to a controller action method), I want to take this cshtml file, get this particular div (I will use some separator/identifier for each of the divs) and return the html. How can I do this?

Or is there a better approach? I don't want to have all the 20 divs hidden in the main view cshtml page.

Thanks.

Upvotes: 0

Views: 230

Answers (1)

bluevector
bluevector

Reputation: 3493

Use a switch in your partial view to select which chunk of content to emit.

Upvotes: 1

Related Questions