Skip to content
Advertisement

Asp.Net adding an extra td

I’m trying to use an ASP:DataList to display data from my data source. Everything works ok, except I’m getting ASP to add an extra column when there isn’t one. The Header Template and Item Template are shown below

And is the the DOM object created. I would expect 5 columns in the table yet it is rendered as 6

I can not figure you why an initial column is being created. I changed the CSS, even removed it and still the same result. I have verified the SQL only returns the 5 columns (even if it returned more or less that shouldn’t make a difference)

Thanks Chris

Advertisement

Answer

The HeaderTemplate and ItemTemplate are meant to be td elements so it automatically creates the td. If you do something like this

It would put the purchase ID in the first td that is created and then fill out the table like you want.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement