473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Datalist - Adding Function to Contol?

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/

<asp:DataList
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>
</asp:DataList>

Thanks
Andy
Jun 1 '07 #1
1 1106
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Andy" <An**@discussions.microsoft.comwrote in message
news:85**********************************@microsof t.com...
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/

<asp:DataList
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>
</asp:DataList>

Thanks
Andy

Jun 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike Malter | last post by:
I take it that the only way to add rows to a DataList control is through DataBind? If not, how do I manually add rows to a DataList control? I have searched everywhere and can't find an example...
1
by: Mikkel Olsen | last post by:
Hi. I have a problem regarding to the DataGrid_ItemDataBound event. I cant run this event when my datagrid is inside a DataList. The ItemDataBound for DataList1 is working well, but it never...
4
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a...
1
by: Mortar | last post by:
Hi, I have a datalist which has a column with data from a database. I would like the column to either show a textbox with the value of the data field, or a button. The contol created would...
8
by: Nevyn Twyll | last post by:
I have a multi-level datalist setup: DataList1 DataList2 MyGrid I have columns explicitly defined for the grid in the html. Sometimes, On the initial Load() of the Page, I want to add extra...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
0
by: bryanp10 | last post by:
I have a DataList on my page which contains multiple DropDownLists. My page defaults to showing six rows in the DataList. I want the ability to dynamically add rows if needed. Right now I'm just...
3
by: Peter | last post by:
I have a datalist and I want the datalist to grow from no records to fill the screen, but not go beyond the screen height. How do I do that? I've implemented the scroll bars but it works only for...
3
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.