0

This is not a problem to create single table and add rows and columns dynamically but the problem is while I'm trying to create multiple tables with all rows and columns dynamically then I'm facing problem.

I'm retrieving a datatable with 4 rows and 5 columns. For every row, I want to put it in a table with its column values. Is there any solution?

1
  • Can u please explain a little bit more or any code which ur working on? Which language ur are using? what is problem statement (to suggest alternative if any)? Commented Nov 6, 2012 at 9:50

1 Answer 1

1

You can use a Repeater control in your asp.net page

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx

Define in the <itemtemplate> the structure of your desired table.

Add as a DataSource of your Repeater a method in your code DataSource="<%# MethodName() %>"

In that method, for each row add a new item in the Repeater and populate it with your row information. It's like creating single tables dynamically, only with a different logic.

It's quite a fuss (don't know why would you want a different table for each row), but Repeater controls are ussualy the way to solve situations when multiple controls are needed.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Coral for your suggestion. I'll try the use of Repeater control. But I got the solution by using DataList control.
See this question with reference to using DataList controls in Repeater stackoverflow.com/questions/2552032/… (it reffers to vb, not c#, but the approach is similar).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.