<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7703664064355888688</id><updated>2012-02-10T16:46:49.060-08:00</updated><title type='text'>Exceldev.com</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ms-technologies.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703664064355888688/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ms-technologies.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Raphaël Désalbres</name><uri>http://www.blogger.com/profile/15177799947234671966</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-qxGMBj860_Q/TzW6OeDOZZI/AAAAAAAACB8/Fz92JFz07cI/s220/Photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7703664064355888688.post-1842554295966369090</id><published>2012-02-10T16:09:00.000-08:00</published><updated>2012-02-10T16:35:14.796-08:00</updated><title type='text'>MVC 3 Helper for Hover Images...</title><content type='html'>&lt;div&gt;&lt;br /&gt;Hi Folks,&lt;br /&gt;&lt;br /&gt;In this post I will talk about something that I haven't found on the internet, which is quite simple to do, which is a MVC Helper for creating a Hover image button...&lt;br /&gt;&lt;br /&gt;If you are a professional developer and work in a team, you must have people which make the graphical stuff of your website, because most developers (like me) just don't like it, it's just a completely separate job.&lt;br /&gt;&lt;br /&gt;This code assumes that you already understand MVC.&lt;br /&gt;&lt;br /&gt;So here are my images, one named OK.png and the other OK_Hover.png, that are located on the Content/Images/Buttons folder.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Now what I want do do is to use my helper (which appears on &lt;strong&gt;listing 1&lt;/strong&gt;), to use it in my razor page, and that upon a click will redirect me to the corresponding view.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;So in my index.cstml I have: &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;@using HoverImageHelper.Helpers;&lt;br /&gt;@{&lt;br /&gt;    ViewBag.Title = "Index";&lt;br /&gt;}&lt;h2&gt;Index&lt;/h2&gt;&lt;br /&gt;@Html.ImageButton("OK", "OK")&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;So the first parameters corresponds to my PNG file, and the second to my action.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/-M5d0zrXs7qg/TzW0JAzoOKI/AAAAAAAACBU/uxMdABpDhPM/s1600/OK.png"&gt;&lt;img style="margin: 0px 10px 10px 0px; width: 80px; height: 24px; float: left; cursor: pointer;" id="BLOGGER_PHOTO_ID_5707666169690339490" border="0" alt="" src="http://4.bp.blogspot.com/-M5d0zrXs7qg/TzW0JAzoOKI/AAAAAAAACBU/uxMdABpDhPM/s320/OK.png" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/-W79k3YEZXi8/TzW0Wi2mU-I/AAAAAAAACBg/2rMO46bQ9o8/s1600/OK_hover.png"&gt;&lt;img style="margin: 0px 10px 10px 0px; width: 80px; height: 24px; float: left; cursor: pointer;" id="BLOGGER_PHOTO_ID_5707666402167903202" border="0" alt="" src="http://4.bp.blogspot.com/-W79k3YEZXi8/TzW0Wi2mU-I/AAAAAAAACBg/2rMO46bQ9o8/s320/OK_hover.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;Listing 1&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;        /// This function creates an image button with a hover, based on a an image name (must be .PNG)&lt;br /&gt;        /// and its corresponding hover image&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;        /// &lt;param name="helper"&gt;&lt;br /&gt;        /// &lt;param name="imageName"&gt;&lt;br /&gt;        /// &lt;param name="actionName"&gt;&lt;br /&gt;        /// &lt;param name="routeValues"&gt;&lt;br /&gt;        /// &lt;returns&gt;&lt;/returns&gt;&lt;br /&gt;        public static MvcHtmlString ImageButton(this HtmlHelper helper, string imageName, string actionName, object routeValues)&lt;br /&gt;        {&lt;br /&gt;            //Gets the action name and routes&lt;br /&gt;            var urlHelper = new UrlHelper(helper.ViewContext.RequestContext);&lt;br /&gt;            var url = urlHelper.Action(actionName, routeValues);&lt;br /&gt;            //Creates the image tag&lt;br /&gt;            var imgTag = new TagBuilder("img");&lt;br /&gt;            var imageUrl = string.Format("/Content/Images/{0}.png", imageName);&lt;br /&gt;            imgTag.Attributes.Add("src", imageUrl);&lt;br /&gt;            imgTag.Attributes.Add("onmouseover", "this.src='" + imageUrl.Replace(".", "_hover.") + "'");&lt;br /&gt;            imgTag.Attributes.Add("onmouseout", "this.src='" + imageUrl + "'");&lt;br /&gt;            imgTag.Attributes.Add("border", "0");&lt;br /&gt;            //Creates the link tag&lt;br /&gt;            TagBuilder imglink = new TagBuilder("a");&lt;br /&gt;            imglink.MergeAttribute("href", url);&lt;br /&gt;            imglink.InnerHtml = imgTag.ToString(TagRenderMode.SelfClosing);&lt;br /&gt;            return MvcHtmlString.Create(imglink.ToString());&lt;br /&gt;        }&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;And a corresponding overload (which I use on this example):&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;Listing 2&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;public static MvcHtmlString ImageButton(this HtmlHelper helper, string imageName, string actionName)&lt;br /&gt;        {&lt;br /&gt;               return ImageButton(helper, imageName, actionName, null);&lt;br /&gt;        }&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Happy programming!!!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;You can grab the full code here:&lt;br /&gt;&lt;iframe style="padding: 0px; background-color: rgb(252, 252, 252);" title="Preview" height="120" marginheight="0" src="https://skydrive.live.com/embed?cid=C80CB697C4B0EB01&amp;amp;resid=C80CB697C4B0EB01%211447&amp;amp;authkey=AJ4-nyhDI-I2ur0" frameborder="0" width="98" marginwidth="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7703664064355888688-1842554295966369090?l=ms-technologies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ms-technologies.blogspot.com/feeds/1842554295966369090/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://ms-technologies.blogspot.com/2012/02/mvc-3-helper-for-hover-images.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703664064355888688/posts/default/1842554295966369090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703664064355888688/posts/default/1842554295966369090'/><link rel='alternate' type='text/html' href='http://ms-technologies.blogspot.com/2012/02/mvc-3-helper-for-hover-images.html' title='MVC 3 Helper for Hover Images...'/><author><name>Raphaël Désalbres</name><uri>http://www.blogger.com/profile/15177799947234671966</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-qxGMBj860_Q/TzW6OeDOZZI/AAAAAAAACB8/Fz92JFz07cI/s220/Photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-M5d0zrXs7qg/TzW0JAzoOKI/AAAAAAAACBU/uxMdABpDhPM/s72-c/OK.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7703664064355888688.post-660070186807904130</id><published>2012-02-10T16:07:00.000-08:00</published><updated>2012-02-10T16:09:07.359-08:00</updated><title type='text'>Excel Macro Tip</title><content type='html'>Hi All,&lt;br /&gt;&lt;br /&gt;When I began writing macros in Excel 5.0 I didn't know how to find the last cell row, given a column...And that's useful, suppose you have a user form, and that you want to put the content of that userform on a sheet.So here's the tip: you just have to declare a long variable (you need this because on Excel 2003/2007 you have more than 32768 rows on a sheet).You can write it like this:&lt;br /&gt;&lt;br /&gt;Dim lastRow as Long&lt;br /&gt;&lt;br /&gt;LastRow=range("A65536").end(xlup).row&lt;br /&gt;&lt;br /&gt;And that's it, folks!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7703664064355888688-660070186807904130?l=ms-technologies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ms-technologies.blogspot.com/feeds/660070186807904130/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://ms-technologies.blogspot.com/2012/02/excel-macro-tip.html#comment-form' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7703664064355888688/posts/default/660070186807904130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7703664064355888688/posts/default/660070186807904130'/><link rel='alternate' type='text/html' href='http://ms-technologies.blogspot.com/2012/02/excel-macro-tip.html' title='Excel Macro Tip'/><author><name>Raphaël Désalbres</name><uri>http://www.blogger.com/profile/15177799947234671966</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/-qxGMBj860_Q/TzW6OeDOZZI/AAAAAAAACB8/Fz92JFz07cI/s220/Photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
