Ask a Question related to ASP.NET, Design and Development.
-
JC #1
Adding a dynamic textbox control to a datagrid with Datatable datasource
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();
JC Guest
-
Accessing Textbox Text After Postback in Dynamic Control
I have an aspx page, which loads a custom usercontrol (UCtrlA). UCtrlA has a drop down list, and depending on what is selected in UCtrlA's drop... -
How to get DataSource for a DropDownList in a Dynamic DataGrid?
Howdy! I am in the midsts of converting some DataGrids which were previously built in HTML into dynamicly added DataGrids which will be called... -
How to gat DataSource for a DropDownList in a Dynamic DataGrid?
Howdy! I am in the midsts of converting some DataGrids which were previously built in HTML into dynamicly added DataGrids which will be called... -
DataGrid ItemStyle is a textbox and doesn't update the datagrid datasource
I have a datagrid with two columns, the first a normal bound column, the second is a template column created from a bound column. For the... -
VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail???
I've had this happen a few times too. I'm still not positive of what exactly causes it but all that's happening is the control that no longer... -
Alex Homer #2
Re: Adding a dynamic textbox control to a datagrid with Datatable datasource
You seem to be adding the TableCell control to the DataTable, whicvh
contains the data to be rendered. This is why you see the class name. You
need to dynamically create the columns in the DataGrid control to include
the text box. There are plenty of examples on the Web of generating a
DataGrid dynamically, such as:
[url]http://www.daveandal.net/books/6744/webforms/dynamicgrid.aspx[/url]
Alex Homer Guest
-
James Crane #3
Re: Adding a dynamic textbox control to a datagrid with Datatable datasource
Hi Alex,
That's a great start for me - much appreciated
James
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
James Crane Guest



Reply With Quote

