473,698 Members | 2,047 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 3689
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
3661
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
2132
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
7250
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
11735
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
2228
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
2681
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
2934
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
1716
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
2788
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
8603
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
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9026
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
8893
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,...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3045
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
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.