Click here to Skip to main content
15,886,830 members
Articles / Web Development / ASP.NET

Associated Icons Image Control

Rate me:
Please Sign up or sign in to vote.
3.92/5 (9 votes)
1 Jun 20055 min read 110.5K   866   34  
A web control that displays the icon image currently associated with a given file or file extension.
<%@ Page language="c#" Codebehind="TestPage.aspx.cs" AutoEventWireup="false" Inherits="AssociatedIcons.TestPage" %>
<%@ Register Tagprefix="SP" Namespace="AssociatedIcons.Controls" Assembly="AssociatedIcons" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
		<title>TestPage</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
  </HEAD>
	<body >
		<form id="TestPage" method="post" runat="server">
			<br>
			<SP:AssociatedIcon id="file1" runat="server" 
				ExtensionOrFile=".doc" largeIcon="True" />
			MyDocument.doc
			
			<br>
			<SP:AssociatedIcon id="file2" runat="server" 
				ExtensionOrFile="file.bmp" largeIcon="false" />
			MyIcon.bmp
			
			<br>
			<SP:AssociatedIcon id="Associatedicon1" runat="server" 
				ExtensionOrFile="file.jpg" largeIcon="true" />
			MyIcon.jpg
			
			<br>
			<SP:AssociatedIcon id="Associatedicon2" runat="server" 
				ExtensionOrFile="file.gif" largeIcon="false" />
			MyIcon.gif
			
			<br>
			<SP:AssociatedIcon id="Associatedicon3" runat="server" 
				ExtensionOrFile="file.mp3" largeIcon="true" />
			MyIcon.mp3
			
			<br>
			<asp:Button ID=test Runat=server  Text=test />
		</form>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
Sergio Pereira is a senior software developer and architect. He currently makes his services available throughout Chicago and suburbs. Sergio has always made himself proficient in mainstream Microsoft technologies and has a deep interest in emerging technologies and the software life cycle aspect of development.
Feel free to contact Sergio at sergio_pereira(AT)msn(dot)com.

Comments and Discussions