473,320 Members | 1,865 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,320 software developers and data experts.

Dynamically Inserting an ID to Each Row

I am creating a table using a datalist and I want to add an ID to the
html tag <tr> of each row created (eg <tr id="1">). I have a JavaScript
function which will change the back color of each row based on its ID.

I have tried using the OnItemCreated event to add an ID to the row.
Here is the code I have tried.

Public Sub Item_Created(ByVal s As Object, ByVal e As
DataListItemEventArgs)

e.Item.ID = "1"

End Sub
This is not working; does anyone if this is possible, and if it is,
what I am doing wrong?

Nov 19 '05 #1
1 886
I asked too quickly as I found the answer in a book.

It turns out I need to build the table as a string in the code behind.
By doing this I can query the dataset to find the information I need
and I will use that info to create my tabel including the ID's. Then I
insert the string with the display.InnerHTML method.

Nov 19 '05 #2

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

Similar topics

10
by: Randy Webb | last post by:
This page: http://www.hikksworld.com/loadJSFiles/ Is one where I was testing the ability of browsers that can/can't dynamically load a JS file with one of the three methods: 1)Changing the src...
8
by: cool2005 | last post by:
I tried to dynamically add/clone a <tr> from an existing <tr> to a <table> but the problem is that I need to have a "onclick" event handler in the <tr>. I have tried following A. approach...
2
by: christine.nguyen | last post by:
Hello all, I have a page called test.html. Within test.html I have an iframe whose source is mypage.html. When mypage.html loads, it dynamically creates a javascript element which contains a...
3
by: Joachim Klassen | last post by:
Hi all, first apologies if this question looks the same as another one I recently posted - its a different thing but for the same szenario:-). We are having performance problems when...
0
by: Dude | last post by:
I am using new_range.InsertAfter txt new_range.ConvertToTable vbTab new_range.InsertBreak new_range.InsertAfter txt2 new_range.ConvertToTable vbTab new_range.InsertBreak
2
by: Ceri | last post by:
I am running an ASP.Net project that runs 30 lengthy SQL Stored Procedures (each takes around 20 seconds to complete). As each Stored Procedure completes, I want to indicate in a table cell that it...
1
by: Jeffrey Todd | last post by:
I have successfully created functionality that mostly models what I'm trying to do - which is dynamically insert controls into a user control (ascx), and insert validation controls, also...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.