DataListItemDataBound2.aspx font size:
C# source: DataListItemDataBound2.aspx   fetchData_oledb.cs   
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<html>
<head>
<title>DataList ItemDataBound Event Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">

<script language="C#" runat="server" src="fetchData_oledb.cs" />

<script runat="server">
string query, country, state, city, sidebarHeader;

private void Page_Load ( object src, EventArgs e ) {
   if ( ! IsPostBack ) {
      query = "SELECT CountryCode, CountryName FROM Countries WHERE CountryCode in ( SELECT DISTINCT Country FROM Hotels ) ORDER BY CountryName";
      lstCountries.DataSource = fetchReader ( query, "hotels" );
      lstCountries.DataBind ( );

      country = Request.Params [ "country" ];
      if ( country != null ) lstCountries.SelectedIndex = lstCountries.Items.IndexOf (
         lstCountries.Items.FindByValue ( country ) );
      else lstCountries.SelectedValue = "US";

      // initialize selection
      getStates ( null, null );
   }
}

private void getStates ( object src, EventArgs e ) {
   country = lstCountries.SelectedValue.Replace ( "'", "''" );
   if ( country == "AU" || country == "CA" || country == "US" ) {
      query = "SELECT StateId, State FROM States WHERE StateId in ( SELECT DISTINCT StateProvince FROM Hotels WHERE Country = '" + country + "' ) ORDER BY State";
      lstStates.DataTextField = "State";
      lstStates.DataValueField = "stateid";
   } else {
      query = "SELECT DISTINCT StateProvince FROM Hotels WHERE Country = '" + country + 
         "' ORDER BY StateProvince";
      lstStates.DataTextField = "StateProvince";
      lstStates.DataValueField = "StateProvince";
   }
   lstStates.DataSource = fetchReader ( query, "hotels" );
   lstStates.DataBind ( );
   panelStates.Visible = ! ( lstStates.Items.Count <= 1 && lstStates.SelectedValue == "" ); 

   state = Request.Params [ "state" ];
   if ( state != null ) lstStates.SelectedIndex = lstStates.Items.IndexOf (
      lstStates.Items.FindByValue ( state ) );

   // initialize selection
   getCities ( null, null );
}

private void getCities ( object src, EventArgs e ) {
   country = lstCountries.SelectedValue.Replace ( "'", "''" );
   state = lstStates.SelectedValue.Replace ( "'", "''" );
   if ( state != "" ) query = "SELECT DISTINCT City FROM Hotels WHERE Country = '" +
      country + "' and StateProvince = '" +
      state + "' ORDER BY City";
   else query = "SELECT DISTINCT City FROM Hotels WHERE Country = '" +
      country + "' and StateProvince is null ORDER BY City";
   lstCities.DataSource = fetchReader ( query, "hotels" );
   lstCities.DataBind ( );

   city = Request.Params [ "city" ];
   if ( city != null ) lstCities.SelectedIndex = lstCities.Items.IndexOf (
      lstCities.Items.FindByValue ( city ) );

   // initialize selection
   fetchHotels ( null, null );
}

private void fetchHotels ( object src, EventArgs e ) {
   country = lstCountries.SelectedValue.Replace ( "'", "''" );
   state = lstStates.SelectedValue.Replace ( "'", "''" );
   city = lstCities.SelectedValue.Replace ( "'", "''" );;

   if ( state != "" ) query = "SELECT Top 10 HotelID, Name, Address1, Address2, Address3, City, StateProvince, Country, PostalCode, LowRate, HighRate, Rating FROM Hotels WHERE Country = '" + country + "' and StateProvince = '" + state + "' and City = '" + city + "' ORDER BY Name";
   else query = "SELECT Top 10 HotelID, Name, Address1, Address2, Address3, City, StateProvince, Country, PostalCode, LowRate, HighRate, Rating FROM Hotels WHERE Country = '" + country + "' and StateProvince is null and City = '" + city + "' ORDER BY Name";
   hotelsList.DataSource = fetchReader ( query, "hotels" );
   hotelsList.DataBind ( );

   sidebarHeader = "Properties in <div class='sidebarcity'>" + city + "</div>";
}

void setListBindings ( object src, DataListItemEventArgs e ) {
   // handles the onItemDataBound event of the sidebar datalist
   if ( e.Item.ItemType == ListItemType.Item ||
         e.Item.ItemType == ListItemType.AlternatingItem ) {

      // set reference to current data record
      IDataRecord dataRow = ( IDataRecord ) e.Item.DataItem;

      string propertyId = dataRow [ "HotelId" ].ToString ( );
      string propertyName = dataRow [ "Name" ].ToString ( );

      // bind property image hyperlink
      HyperLink hotelImgLink = ( HyperLink ) e.Item.FindControl ( "hotelImgLink" );
      hotelImgLink.NavigateUrl = string.Format ( "~/travel/hotel.aspx?id={0}", propertyId );
      hotelImgLink.ToolTip = propertyName;
      hotelImgLink.Attributes [ "onMouseOver" ] = "status='" +
         propertyName.Replace ( "'", "\\'" ) + "';return true";

      Image hotelImg = ( Image ) e.Item.FindControl ( "hotelImg" );
      string imageUrl = getImageUrl ( propertyId );
      hotelImg.ImageUrl = imageUrl.StartsWith ( "http" ) ? imageUrl :
         string.Format ( "http://images.travelnow.com/{0}", imageUrl );
      if ( imageUrl == "" ) hotelImg.ImageUrl = "~/travel/images/default-hotel.gif";
      hotelImg.Width = 64; hotelImg.Height = 64;

      // bind property name hyperlink
      HyperLink hotelUrl = ( HyperLink ) e.Item.FindControl ( "hotelUrl" );
      hotelUrl.NavigateUrl = string.Format ( "~/travel/hotel.aspx?id={0}", propertyId );
      hotelUrl.Text = propertyName;
      hotelUrl.ToolTip = propertyName;
      hotelUrl.Attributes [ "onMouseOver" ] = "status='" +
         propertyName.Replace ( "'", "\\'" ) + "';return true";

      // bind rating image
      float rating = float.Parse ( dataRow [ "Rating" ].ToString ( ) );
      HyperLink ratingImg = ( HyperLink ) e.Item.FindControl ( "ratingImg" );
      ratingImg.ImageUrl = getRatingImage ( rating );
      ratingImg.NavigateUrl = "http://travel.ian.com/index.jsp?pageName=legend&cid=179392";
      ratingImg.ToolTip = rating + " out of 5 stars";
      if ( ratingImg.ImageUrl.IndexOf ( "0-0") > -1 ) {
         ratingImg.ToolTip = "Not available";
      }
      ratingImg.Attributes [ "onMouseOver" ] = "status='" +
         propertyName.Replace ( "'", "\\'" ) + "';return true";

      // get average rate
      double avgrate = ( ( double ) ( dataRow [ "LowRate" ] ) + ( double ) ( dataRow [ "HighRate" ] ) ) / 2;
      ( ( Label ) e.Item.FindControl ( "avgrate" ) ).Text = 
         "<b>Average Nightly Rate: <span style='color: maroon'>" +
            string.Format ( "${0:n2}", avgrate ) + "</span></b>";
   }
}

string getImageUrl ( string hotelId ) {
   return Convert.ToString ( fetchScalar ( "SELECT ThumbnailUrl FROM Images WHERE HotelId = '" +
      hotelId + "' ORDER BY Category, Caption, Url", "hotels3" ) );
}

string getRatingImage ( float rating ) {
   int nrating = ( int ) rating;
   if ( rating % 1 >= .5 ) return string.Format ( "/travel/images/stars-{0}-5.gif", nrating );
   else return string.Format ( "/travel/images/stars-{0}-0.gif", nrating );
}
</script>

<style type="text/css">
   .sidebarcity {
      font-weight: bold; background-color: sienna; color: beige }
</style>
</head>

<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h2>DataList <b>ItemDataBound Event</b> Example</h2></div>
<hr size=1 width=92%>

<table width=100% cellpadding=0 cellspacing=0>
<tr valign="top">
   <td width=80%><div style="margin: 12 40 5 40">

   <form runat="server">
      <table align="center" cellpadding=3>
      <tr>
         <td>Select Country:<br>
         <asp:dropdownlist id="lstCountries" runat="server" 
            datatextfield="countryname" datavaluefield="countrycode" 
            onSelectedIndexChanged="getStates" autopostback /></td>
         <asp:panel id="panelStates" runat="server" visible=false>
            <td>State:<br>
            <asp:dropdownlist id="lstStates" runat="server" 
               onSelectedIndexChanged="getCities" autopostback /></td>
         </asp:panel>
         <td>City:<br>
         <asp:dropdownlist id="lstCities" runat="server" 
            datatextfield="city" datavaluefield="city"
            onSelectedIndexChanged="fetchHotels" autopostback /></td></tr>
      </table>

   </form>

   <p>The <i>ItemDataBound</i> event is raised whenever an item in the <b>DataList</b> control is bound to data. </p>

   <p>This event provides an opportunity to access each item before the page is finally sent to the client for display. After this event is raised, the data item is nulled out and no longer available. </p>

   <p>This example illustrates a way to handle the <i>ItemDataBound</i> event of a <b>DataList</b>. </p>

   <p>The sidebar on the right panel contains a <b>DataList</b> control that is used to display a selection of hotels. </p>

   <p>In this case, the <i>ItemDataBound</i> event handler is used to accomplish the following:
   <ul>
      <li>obtain and set the <b>ImageUrl</b>, <b>NavigateUrl</b>, <b>ToolTip</b> and <b>Attributes</b> properties for the hotel image hyperlink;</li>
      <li>obtain and set the <b>Text</b>, <b>NavigateUrl</b>, <b>ToolTip</b> and <b>Attributes</b> properties for the hotel name hyperlink;</li>
      <li>obtain and set the <b>ImageUrl</b>, <b>NavigateUrl</b>, <b>ToolTip</b> and <b>Attributes</b> properties for the rating image hyperlink;</li>
      <li>compute and set the average nightly rate.</li>
   </ul></p>

   <p>&nbsp;<!-- spacer --></p>

   <p>&nbsp;<!-- spacer --></p>

   <!-- #include virtual="~/shared/viewsrc.inc" -->

   </div>

   </td>

   <td width=20% align="center" style="background: lightsteelblue">

      <br>

      <div align="center" style="margin: 10 10 10 10; background-color:ghostwhite">

      <asp:datalist id="hotelsList" runat="server"
         width=90% cellpadding=4 backcolor="ghostwhite" font-size=8pt
         onItemDataBound="setListBindings">

         <headerstyle backcolor="darkslategray" forecolor="khaki"
            horizontalalign="center" font-bold />

         <itemstyle verticalalign="top" />

         <headertemplate><%= sidebarHeader %></headertemplate>

         <itemtemplate>
            <table width=100% style="font-size:8pt">
            <tr align="center" valign="top">
               <td>
                  <asp:hyperlink id="hotelImgLink" runat="server" target="travel"><asp:image id="hotelImg" runat="server" /></asp:hyperlink>
               </td>
            <tr align="center" valign="top">
               <td>
                  <asp:hyperlink id="hotelUrl" runat="server" target="travel" />
                  <br>
                  <%# Eval ( "Address1" ) %><%# Eval ( "Address2", ", {0}" ) %><%# Eval ( "Address3", ", {0}" ) %>
                  <br>
                  <%# Eval ( "City" ) %>
                  <br>
                  <asp:hyperlink id="ratingImg" runat="server" target="ian" />
                  <br>
                  <asp:label id="avgrate" runat="server" />
               </td></tr>
            </table>
         </itemtemplate>

         <separatortemplate><hr size=1 width=92%></separatortemplate>

      </asp:datalist>

      </div>
   </td></tr>
</table>

<hr size=1 width=92%>

</body>
</html>