MVC Framework - Giving An Ajax Image Link

by Bar Zohan 21. January 2010 00:25

Mvc framework has an html helper for giving ajax links (Ajax.ActionLink), but it does not provide one  like Ajax.ImageActionLink. But ofcourse there is a simple, tricky workaround Wink.

<%= Ajax.ActionLink("[imglnk]", "IndexContent", new { id = "main" }, new AjaxOptions { UpdateTargetId = "RightContent", OnBegin = "beginAjax", OnSuccess = "successAjax", OnFailure = "failureAjax" }, new { control = "content", index = "anasayfa" }).Replace("[imglnk]", "<img src=\"/i/logo.gif\" ... />")%>

 

The thing that is done here is realy simple; I normally create an Ajax Link using Ajax.ActionLink that writes '[imglnk]' on the page. After that I replace the '[imglnk]' text with standart html code that puts an image on the page.

 

kick it on DotNetKicks.com

Tags: , ,

.Net Framework | C# | Web | Asp.Net | MVC

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Page List