DataTable and Repeater Control, performance question?

D

DotNetDev

I am trying to display a dynamic checkboxlist. I have a datatable with 4
columns.
ItemId, ItemTitle, ItemDescription, ItemUrl.

Two of these columns are required. ItemId and ItemTitie.
If for certain items the ItemUrl is present then I would like to append it
to the item Title like '[]ItemTitle (hereis ItemUrl)'. Other wise just
display the item title next to the checkbox.
Since I need this little formatting on the item title , simple
DataSource/Binding wouldn't work.
I have two options
i) Either alter the itemtitle at the ItemDataBound Event.
ii) or Make a clone of the DataTable and alter the ItemTitle column to
include the itemUrl and then bind this new DataTable to the repeater.

My questoin is which option is more efficient and why?

I would really appreciate your knowledgable input.

Thanks.
 
D

DotNetDev

After getting the clone, I would merge the two columns so ItemTitle would
also contain ItemUrl if its present and then binding would be simple.

Eliyahu Goldin said:
It is not clear to me what could be the advantages of cloning. The same code
that you need to execute in the ItemDataBound event for every item will have
to execute on the datatable rows anyway.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


DotNetDev said:
I am trying to display a dynamic checkboxlist. I have a datatable with 4
columns.
ItemId, ItemTitle, ItemDescription, ItemUrl.

Two of these columns are required. ItemId and ItemTitie.
If for certain items the ItemUrl is present then I would like to append it
to the item Title like '[]ItemTitle (hereis ItemUrl)'. Other wise just
display the item title next to the checkbox.
Since I need this little formatting on the item title , simple
DataSource/Binding wouldn't work.
I have two options
i) Either alter the itemtitle at the ItemDataBound Event.
ii) or Make a clone of the DataTable and alter the ItemTitle column to
include the itemUrl and then bind this new DataTable to the repeater.

My questoin is which option is more efficient and why?

I would really appreciate your knowledgable input.

Thanks.
 
A

Angel

I may not understand the problem but it sound to me you would like to alter
dynamically the second column. If I was doing it I would populate my control
programatically exercising full control over what is rendered. You might
also create SQL query that provides two columns and performs this process
dynamically at this level. Leaving you with a simple databind all over again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top