开发者

MVC - Can a partial view replace itself

开发者 https://www.devze.com 2023-04-05 22:34 出处:网络
I have a strong typed partial view of a class that contains a list of image urls and the index of the current image. Now I need a 开发者_StackOverflow社区\"next\" button that reloads my partial view w

I have a strong typed partial view of a class that contains a list of image urls and the index of the current image. Now I need a 开发者_StackOverflow社区"next" button that reloads my partial view with the updated index. The point is that I don't want to save this list or index with javascript. The partial view will render the image as follows:

<img id="imgMain" src="<%: Url.Content(Model.GetCurrentImageUri().RelativeUri.ToString()) %>" alt="" />

Thank you very much for your help!


The solution is to store the index of my array in a hidden field. Then I fetch the data with a ajax call and replace my partial view with the resulting data. That is all, very easy :)

0

精彩评论

暂无评论...
验证码 换一张
取 消