473,508 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Container.DataItem

I'm having trouble with C# syntax for Container.DataItem. This is the
VB version. CAn anybody help me out with the syntax?

<asp:DataList runat="server" id="dlResults"
Font-Name="Verdana" Font-Size="10pt">

<ItemTemplate>
<span style="font-size:15pt;font-weight:bold;">
<%# Container.DataItem.title %>
</span><br />
<%# Container.DataItem.snippet %><br />
[<a href="<%# Container.DataItem.URL %>"><%#
Container.DataItem.URL %></a>]
</ItemTemplate>

<SeparatorTemplate>
<p> </p>
</SeparatorTemplate>

</asp:DataList>

Any help would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
1 14281
HI Mike,

What is the type of the bounded collection?

Container.DataItem is an object for the instance being bounded, if it's a
datatable for example you could do like this
((DataRow)Container.DataItem)["ColumnName"]

or if it's a strong typed collection of some type you could do like this
((CollectionType)Container.DataItem).Property

hoe this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:Ou*************@TK2MSFTNGP09.phx.gbl...
I'm having trouble with C# syntax for Container.DataItem. This is the
VB version. CAn anybody help me out with the syntax?

<asp:DataList runat="server" id="dlResults"
Font-Name="Verdana" Font-Size="10pt">

<ItemTemplate>
<span style="font-size:15pt;font-weight:bold;">
<%# Container.DataItem.title %>
</span><br />
<%# Container.DataItem.snippet %><br />
[<a href="<%# Container.DataItem.URL %>"><%#
Container.DataItem.URL %></a>]
</ItemTemplate>

<SeparatorTemplate>
<p> </p>
</SeparatorTemplate>

</asp:DataList>

Any help would be really appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2

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

Similar topics

2
19759
by: az bij | last post by:
Hi, I have a dataset bound to a repeater and want to place some logic in my ascx file. I want to display an image link if and only if an image is available. I have tried without success...
1
3093
by: Chris Fink | last post by:
Hi, My question is how do I set some text within my datalist itemtemplate to be bold, based on the higher value of two bound data items? For example, if the value of <%#...
1
2857
by: anony | last post by:
Hi, I would like to find out if it's possible to check the value of a Container.DataItem inside the Datagrid's <ItemTemplate> tag .... based on it's value, I would to either output it or output...
5
724
by: bg | last post by:
Hi! How do I check if "date" exists before using that code? I've built a RSSreader and sometimes there's a date in it and sometimes not. How can I check if it exists to avoid crash...
2
3385
by: Antony | last post by:
Hello, in my aspx.file I have this code inside a datagrid: <asp:TemplateColumn HeaderText="Picture"> <ItemTemplate> <asp:Image id="Image1" runat="server" ImageUrl='upload/<%#...
0
1304
by: John Davis | last post by:
Hi all, hope you are well. I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource object. I am currently creating some...
0
1369
by: John Davis | last post by:
Hi all, hope you are well.(not sure if this posted the first time) I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource...
4
629
by: rn5a | last post by:
When I do this: <asp:DataList ID="dlProducts" runat="server"> <HeaderTemplate> <table border="0"> <tr> <td>Category</td> <td><%# Container.DataItem("Category") %></td> </tr> </table>
3
3442
by: alberthung01 | last post by:
Hi all, I try to use Container.DataItem() in my DataGrid's ItemTemplate. Somewhere it works fine. eg.<input type=checkbox id='cb_select_<%# Container.DataItem("TAG_ID") %>' value='<%#...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7123
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
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7046
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...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.