2

is it possible to add a user control in a datatable in asp.net c#? The following code produces this: System.Web.UI.WebControls.TextBox instead of an input

    dr[0] = new TextBox (); // where dr is a dataRow and the datatable is 
                            // bound to a datagrid in the user control
1
  • It may be better that you tell us what you are trying to achieve because a DataTable is used for transferring data to and from a database and I don't see what a TextBox in a database is going to achieve. Commented May 9, 2011 at 23:54

1 Answer 1

2

As far I know, datatable can keep any data (may be in string format in your case) and give the output. But That doesnt mean that it will show you the control instead of textbox in output. To display Textbox in output there are other methods.

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

2 Comments

Thanks. I will consider this as the answer. I was trying to create a dynamic table which the columns, rows and the content will be determined by the end-user. As a solution, I came with up with constructing a datatable and then binding the actual table and constructing it according to the data within the datatable
@Shaokan: DataTable has nothing to do with controls. It only holds data.

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.