title: How to access Panel id from public function inside Repeater Control
body: <p>I need to show list of years for which i have Photo albums. I use Repeater control for this and wrapper year inside a div control. I also pass current Year as <code>QueryString</code> . I need to show the current year in red as a background for div.  my panel always return null as i am not able to pass the <code>Object Sender, RepeaterItemEventArgs e</code>. How can i alter this code so that i can change the CssClass from code behind.</p>
  
  <p>I can use another approach for same by using <code>Literal Control</code> &amp; show my list of Years as List <code>&lt;ul&gt;</code>... which i can use &amp; have full control over my list css.</p>
  
  <p>Please advice how i can achieve this in best &amp; effective way. I am also keep to get in done in the way i am trying to do it as it might be useful in future &amp; very education for me </p>
  
  <p><code>http://localhost:65123/Gallery/Albums.aspx?Year=2011&amp;PageID=38</code></p>
  
  <pre><code>&lt;asp:Repeater ID="rptAlbumsYears" runat="server" &gt;
      &lt;ItemTemplate&gt;
          &lt;div class="AlbumPageYearListing"&gt;
              &lt;asp:HyperLink ID="hyplnkCat1" runat="server" NavigateUrl='&lt;%# getAlbumURLbyCat(Eval("Year"))%&gt;'&gt;
                  &lt;asp:Panel ID="pnlYear" runat="server"&gt;
                      &lt;asp:Label ID="lblAlbumYear" runat="server" Text='&lt;%# Eval("Year")%&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/asp:Panel&gt;
              &lt;/asp:HyperLink&gt;
          &lt;/div&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>.CS Code</p>
  
  <pre><code>protected String getAlbumURLbyCat(object Year)
  {
      string url;
      int PageID = Helper.GetPageIDbyName("Albums.aspx", "en-us");
      url = "~/Albums.aspx?Year=" + Year + "&amp;PageID=" + PageID;
      try
      {
          int CurYear = 0;
          CurYear = int.Parse(Request["Year"].ToString());
          int iYear = int.Parse(Year.ToString());
          //Image imgArticleList = (Image)e.Item.FindControl("imgArticleList") as Image;
          Panel pnlYear = (Panel)FindControl("pnlYear");
  
         // Panel pnlYear = (Panel) 
          if (CurYear == iYear)
          {
              pnlYear.CssClass = "AlbumPageYearListingCurrent";
          }
      }
      catch (Exception ex)
      {
      }
  </code></pre>