PC Review


Reply
Thread Tools Rate Thread

Datalist - Adding Function to Contol?

 
 
=?Utf-8?B?QW5keQ==?=
Guest
Posts: n/a
 
      1st Jun 2007
Hello All:

I have the following DataList. In the <TD class="photo"> line, I would like
to be able to add some code where I can gather the actual size of the photo,
then pass that to the popImage javascript function. I am really at a loss at
this time as to how to do this. Could anyone give me some direction on how I
can go about doing this/

<aspataList
ID="photos"
RepeatColumns="5"
RepeatDirection="Horizontal"
CellPadding="10"
EnableViewState="false"
Runat="server">
<ItemTemplate>
<table width="100%">
<tr>
<td valign="top">
<table class="rightSideTable" width="100%">
<tr>
<td valign="top" class="rightSideTitle">
<%# DataBinder.Eval(Container.DataItem, "Title") %>
</td>
</tr>
<tr>
<td class="photo">
<a href="javascript: popImage('/Photos/Photos/<%#
DataBinder.Eval
(Container.DataItem, "Path") %>',
'<%# DataBinder.Eval(Container.DataItem, "Title")
%>')">
<img src="/Photos/Thumbnails/<%#
DataBinder.Eval(Container.DataItem, "Thumbnail") %>"
width="133" height="100" border="0" alt="">



</a>
</td>
</tr>
<tr>
<td class="rightSideInfo"><%#
DataBinder.Eval(Container.DataItem, "Location") %></td>
</tr>
<tr>
<td class="rightSideInfo"><%#
DataBinder.Eval(Container.DataItem, "ImageDate") %></td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</aspataList>

Thanks
Andy
 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      2nd Jun 2007
You may want to look into using the ItemDataBound event. While in the
ItemDataBound event, you can access controls that are part of the Item by
using the following method:

CType(e.Item.FindControl("btnMoveUp"), Button)

You would then treat the above code exactly the same as if it were the
control (you can access/set properties, use methods, etc.) Good Luck!
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Andy" <(E-Mail Removed)> wrote in message
news:85B1AEB5-AE3E-4F54-A394-(E-Mail Removed)...
> Hello All:
>
> I have the following DataList. In the <TD class="photo"> line, I would
> like
> to be able to add some code where I can gather the actual size of the
> photo,
> then pass that to the popImage javascript function. I am really at a loss
> at
> this time as to how to do this. Could anyone give me some direction on
> how I
> can go about doing this/
>
> <aspataList
> ID="photos"
> RepeatColumns="5"
> RepeatDirection="Horizontal"
> CellPadding="10"
> EnableViewState="false"
> Runat="server">
> <ItemTemplate>
> <table width="100%">
> <tr>
> <td valign="top">
> <table class="rightSideTable" width="100%">
> <tr>
> <td valign="top" class="rightSideTitle">
> <%# DataBinder.Eval(Container.DataItem, "Title")
> %>
> </td>
> </tr>
> <tr>
> <td class="photo">
> <a href="javascript: popImage('/Photos/Photos/<%#
> DataBinder.Eval
> (Container.DataItem, "Path") %>',
> '<%# DataBinder.Eval(Container.DataItem, "Title")
> %>')">
> <img src="/Photos/Thumbnails/<%#
> DataBinder.Eval(Container.DataItem, "Thumbnail") %>"
> width="133" height="100" border="0" alt="">
>
>
>
> </a>
> </td>
> </tr>
> <tr>
> <td class="rightSideInfo"><%#
> DataBinder.Eval(Container.DataItem, "Location") %></td>
> </tr>
> <tr>
> <td class="rightSideInfo"><%#
> DataBinder.Eval(Container.DataItem, "ImageDate") %></td>
> </tr>
> </table>
> </td>
> </tr>
> </table>
> </ItemTemplate>
> </aspataList>
>
> Thanks
> Andy



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding ImageButton into Datalist =?Utf-8?B?SnVuaW9yUHJvZ3JhbW1lcg==?= Microsoft ASP .NET 3 21st Mar 2006 07:07 PM
Adding new line character to string using TextBox contol (CF) =?Utf-8?B?Y2hhcmxpZXdlc3Q=?= Microsoft C# .NET 6 11th Oct 2004 06:24 PM
Adding dropdownlist to a datalist =?Utf-8?B?U2hpanUgUG95aWxpbA==?= Microsoft ASP .NET 2 30th Aug 2004 08:33 AM
Adding new rows in Datalist anon Microsoft ASP .NET 3 7th Aug 2004 05:53 PM
Adding rows to a datalist Mike Malter Microsoft C# .NET 1 23rd Sep 2003 12:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:51 AM.