Adding a dynamic textbox control to a datagrid with Datatable datasource

J

JC

Hi,

I have a datagrid, and I want to bind this to a datatable, and I would
like to have textbox controls and one button control.

The problem is the textbox controls - they don't render, at run time
it just says 'System.Web.UI.WebControls.TableCell'

Any help would be appreciated.

TextBox txtQty = new TextBox();
txtQty.Text="erm";

TableCell oTc = new TableCell();
oTc.Controls.Add(txtQty);
DataTable oDt = new DataTable();
oDt.Columns.Add("Qty");
oDt.Columns.Add("Price");
oDt.Columns.Add("Details");
oDt.Columns.Add("Action");
DataRow oDr = oDt.NewRow();
oDr["Qty"] = oTc;
oDr["Price"] = "1";
oDr["Details"] = "1";
oDt.Rows.Add(oDr);
dgQty.DataSource = oDt;
dgQty.DataBind();
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top