M
micah
I am somewhat new to the .net framework, and I am completely stumped on
something that I feel should be relatively simple.
1. I need to dynamically create controls on a web page
This is not a problem.
2. In order to format these dynamic controls how I want them, I first
decided to put them in a Table Control.
This worked fine, unfortunately the Table Control doesnt remember
viewstate so it wont work for what I need.
3. To get around the viewstate problem I decided to go forward by using
a DataGrid. I discovered I could dynamically add rows to a DataTable
and then bind that DataTable to the DataGrid
Thats fine and dandy, works ok.
4. When I assign an actual control like a TextBox to one of the items
in the myDataTable.NewRow()["myColumn"], all I get is
"System.Web.UI.WebControls.TextBox" and not the actual control itself.
I figured I could fix this by specifying the type on the columns for
the datatable via
System.Type.GetType("System.Web.UI.WebControls.TextBox"), but this
returns NULL and creates an error.
Can anyone help clear this up for me? One extremely frustrated
programmer. -micah
something that I feel should be relatively simple.
1. I need to dynamically create controls on a web page
This is not a problem.
2. In order to format these dynamic controls how I want them, I first
decided to put them in a Table Control.
This worked fine, unfortunately the Table Control doesnt remember
viewstate so it wont work for what I need.
3. To get around the viewstate problem I decided to go forward by using
a DataGrid. I discovered I could dynamically add rows to a DataTable
and then bind that DataTable to the DataGrid
Thats fine and dandy, works ok.
4. When I assign an actual control like a TextBox to one of the items
in the myDataTable.NewRow()["myColumn"], all I get is
"System.Web.UI.WebControls.TextBox" and not the actual control itself.
I figured I could fix this by specifying the type on the columns for
the datatable via
System.Type.GetType("System.Web.UI.WebControls.TextBox"), but this
returns NULL and creates an error.
Can anyone help clear this up for me? One extremely frustrated
programmer. -micah