473,725 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataList - accessing <tr>

I have a data list control with 3 columns. I want every second *row* to
have a dfferent CSS class. Can someone tell me how to access the parent
tablerow, and add a cssclass? I'm guessing I'll need to put some code in
the itemcreated or itemdatabound?

Thanks in advance,

Duncan

---/ snip /---

<asp:datalist id="dlRegionLis t" runat="server" repeatcolumns=3
cssclass="tbl" width="100%">
<itemtemplate >
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %>">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</itemtemplate>

<alternatingite mtemplate>
<!-- this needs to have: tr class="tbl_2row " -->
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</alternatingitem template>
</asp:datalist>

Nov 17 '05 #1
3 3692
Define an ItemTemplate and an AlternateItemTe mplate. This allows you to have
every other item with a different format.

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:eC******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a data list control with 3 columns. I want every second *row* to
have a dfferent CSS class. Can someone tell me how to access the parent
tablerow, and add a cssclass? I'm guessing I'll need to put some code in
the itemcreated or itemdatabound?

Thanks in advance,

Duncan

---/ snip /---

<asp:datalist id="dlRegionLis t" runat="server" repeatcolumns=3
cssclass="tbl" width="100%">
<itemtemplate >
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %>">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</itemtemplate>

<alternatingite mtemplate>
<!-- this needs to have: tr class="tbl_2row " -->
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</alternatingitem template>
</asp:datalist>

Nov 17 '05 #2
Marina,

Thanks for your reply. At the bottom of the post, I'd included the code -
including an itemtemplate and alternateitemte mplate; this doesn't work, as
we're effectively trying to style the whole parent row, not a single item.

Any thoughts?

D

"Marina" <so*****@nospam .com> wrote in message
news:O0******** ********@TK2MSF TNGP15.phx.gbl. ..
Define an ItemTemplate and an AlternateItemTe mplate. This allows you to
have every other item with a different format.

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:eC******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a data list control with 3 columns. I want every second *row* to
have a dfferent CSS class. Can someone tell me how to access the parent
tablerow, and add a cssclass? I'm guessing I'll need to put some code in
the itemcreated or itemdatabound?

Thanks in advance,

Duncan

---/ snip /---

<asp:datalist id="dlRegionLis t" runat="server" repeatcolumns=3
cssclass="tbl" width="100%">
<itemtemplate >
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %>">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</itemtemplate>

<alternatingite mtemplate>
<!-- this needs to have: tr class="tbl_2row " -->
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</alternatingitem template>
</asp:datalist>


Nov 17 '05 #3
Try putting everything in each template into a div, with the appropriate
css class.
"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
Marina,

Thanks for your reply. At the bottom of the post, I'd included the code -
including an itemtemplate and alternateitemte mplate; this doesn't work, as
we're effectively trying to style the whole parent row, not a single item.

Any thoughts?

D

"Marina" <so*****@nospam .com> wrote in message
news:O0******** ********@TK2MSF TNGP15.phx.gbl. ..
Define an ItemTemplate and an AlternateItemTe mplate. This allows you to
have every other item with a different format.

"Dunc" <du**@ntpcl.f9. co.uk> wrote in message
news:eC******** ********@TK2MSF TNGP09.phx.gbl. ..
I have a data list control with 3 columns. I want every second *row* to
have a dfferent CSS class. Can someone tell me how to access the parent
tablerow, and add a cssclass? I'm guessing I'll need to put some code in
the itemcreated or itemdatabound?

Thanks in advance,

Duncan

---/ snip /---

<asp:datalist id="dlRegionLis t" runat="server" repeatcolumns=3
cssclass="tbl" width="100%">
<itemtemplate >
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %>">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</itemtemplate>

<alternatingite mtemplate>
<!-- this needs to have: tr class="tbl_2row " -->
<a href="search.as p?area=<%# DataBinder.Eval (Container.Data Item,
"Regions_ID ") %">
<%# DataBinder.Eval (Container.Data Item, "RegionName ") %>
</a>
</alternatingitem template>
</asp:datalist>



Nov 17 '05 #4

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

Similar topics

2
3664
by: John Geddes | last post by:
In both IE6 and Netscape 7: insertRow method of tbody is behaving as expected: - inserts a new row - increases tbody.rows.length BUT deleteRow is not doing the opposite. It DOES delete the row, but it adds a <TR></TR> pair just before the </TBODY> and that leaves the tbody.rows.length count unchanged.
7
2154
by: F. Da Costa | last post by:
Hi, I' looking to retrieve ProdName1 form the <tr> below. <tr id="1-1-1" class="even"> <td> <div class="tier4"> <a href="#" class="leaf"></a> ProdName1 </div>
4
7268
by: El Diablo | last post by:
Hi there, I'm trying dynamically generate extra rows in a table. So far this achieves this task within the tHead segment: theTable.tHead.appendChild(document.createElement('TR')) ....but this only gives me table rows with no table data cells. So I would like to know if it's possible to create several <TH> within the tHead row using this method?
3
11757
by: Christopher Benson-Manica | last post by:
I have an HTMLInputElement in a <td>. I want to access all the <td>'s in the same row as the input element. var tr=theInputElement.parentNode.parentNode; Why isn't the input element's parent's parent the <tr> node in Firefox? Internet Explorer seems to think so. How can I get the <tr> node (so I can iterate through its children) in Firefox? Why does this stuff have to be such a humongous god-forsaken
1
2241
by: prefersgolfing | last post by:
I'm not using Master Pages, yet I'd like to display the contents of an HTML page within a <table><tr><td> on a .aspx. I have a lengthy guide already paginated in html. I'd like to embed the pages "as is" in the new 2.0 app without using Master Pages or creating new ..aspx's. I'm looking for the quickest way to the finish line. Any suggestions would be welcomed. Thanks.
2
2685
by: petereffect | last post by:
i have foll. code <tr> <a href="a1.shtml"> <td width='100%'> &nbsp;"+Testing+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td> </a>
5
2936
by: mahesr | last post by:
I want to match some particular text between <tr>and </tr> or <td>and </td>.... in PHP. like below............ <table><tr> CATEGORY: <td><font face="Verdana" size="1" color="#A000A0"> Wedding Accessories
3
1717
by: jack | last post by:
Hi all im Creating a report in HTML with the help of dotnet.. im creating a which shows a data of 12 months .. the forst row of the column contains month names.. and the following data.. The table which contains a data is under div which has a scroll bar.. What in trying to do is freeze the first row of the table which is been generated.. when scrolled vertically And the first column of the table when scrolled horizonatlly... I have...
7
2791
by: Xiaoyan | last post by:
Hi,everyone: I have a problem now. I can't get the information between the <tr><td> and </td></tr>. for example: I use this regular expression can't get it, I don't know why. $test=~/<tr><td>(.*)<\/td><\/td>(.*)<\/td><\/tr>/ms; <tr><td>station</td> <td>station number/identification, see chart above: <br> B = GoMoos buoy B location<br> S = New Scantum at the southern edge Jefferys Ledge</td></tr>.
0
8888
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9176
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
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 we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.