Getting custom data for ItemTemplate within asp:Repeater

Posted on January 29, 2007 by ZDima.
Categories: ASP.NET.
  1. <asp:Repeater ID="Repeater1" runat="server" DataSourceID="NewsDataSource">
  2.   <HeaderTemplate>
  3.     <table style="border-collapse: collapse;" bgcolor="#ffffee" border="0" cellpadding="2">
  4.       <tbody><tr><td>
  5.   </HeaderTemplate>
  6.   <ItemTemplate>
  7.       <p class="Pbullets" dir="ltr">
  8.       <img src="img/bullet<%# getBulletImage(Container.DataItem) %>.gif" border="0"> <a href="page.asp" class="bullets" /><%# Eval("Title") %></a></p>
  9.   </ItemTemplate>
  10.   <FooterTemplate>
  11.       </td></tr></tbody>
  12.     </table>
  13.   </FooterTemplate>
  14. </asp:Repeater>
  1. protected string getBulletImage(object dataItem)
  2. {
  3.   DataRowView row = dataItem as DataRowView;
  4.   switch( int.Parse(row["field"].ToString()) )
  5.   {
  6.   case 1:
  7.     return "A";
  8.   case 2:
  9.     return "B";
  10.   case 3:
  11.     return "C";
  12.   }
  13.   return "";
  14. }

Hot to get an absolute location of the HTML element

Posted on January 27, 2007 by ZDima.
Categories: Dynamic HTML.

The function below will give you absolute position of an element in the browser window. This you will need to move element to position relative to another element’s position.

  1. function findPos(obj)
  2. {
  3.   var curleft = curtop = 0;
  4.   if (obj.offsetParent)
  5.   {
  6.     curleft = obj.offsetLeft;
  7.     curtop = obj.offsetTop;
  8.     while (obj = obj.offsetParent)
  9.     {
  10.       curleft += obj.offsetLeft;
  11.       curtop += obj.offsetTop;
  12.     }
  13.   }
  14.   return [curleft,curtop];
  15. }

Remember, when you need to set new position, the value must be in pixels.

  1. toolTip.style.top = new_Y+"px";
  2. toolTip.style.left = new_X+"px";

Protected: Commvault Christmas party

Posted on January 18, 2007 by ZDima.
Categories: Personal.

This post is password protected. To view it please enter your password below:


Enter your password to view comments

Protected: Trial license in Galaxy

Posted on by ZDima.
Categories: GALAXY.

This post is password protected. To view it please enter your password below:


Enter your password to view comments

Communicating to Flash movie from browser’s JavaScript.

Posted on January 2, 2007 by ZDima.
Categories: Flash.

As you can see on my web site, the menu implemented there using a Flash movie.
When I decided to provide a link from one page of the web site to another, the question was how to change the active site section in a flash movie. I search Internet and found several solutions how to communicate with the Flash movie, but for some reason it was not working for me.
All HTML pages, flash movies and images where located in the same directory on my local computer. I was always getting -1 as a result code for TCurrentFrame or error message in FireFox’s error console Error: Error calling method on NPObject!. Any attempt to revive this interface was failing and there is no clue left on Internet on how to deal with that. (more…)