Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Add controls in datatable

Reply
Thread Tools

Add controls in datatable

 
 
Andre
Guest
Posts: n/a
 
      02-27-2004
Hi,

I want to add a Textbox in my datatable before binding my datagrid with
it. But i can't find a way to do it.

Did someone know what i'm doing wrong ?

- If i write <asp:textbox....> the column is empty.
- If i create my textbox on the onitemdatabind event, my textbox is on
another line of the datagrid.
- if i try to make it this way my colum is empty :
Dim txtbox As New TextBox
txtbox.Visible = True
txtbox.Attributes.Add("runat", "server")
txtbox.ID = "opt"
txtbox.EnableViewState = True
dr(1) = txtbox

Thank you, and i paste a copy of my code below.


Dim dt As DataTable = New DataTable
Dim dr As DataRow
Dim dv As DataView

dt.Columns.Add(New DataColumn("Service", GetType(String)))
dt.Columns.Add(New DataColumn("Option", GetType(TextBox)))
dt.Columns.Add(New DataColumn("Install", GetType(Decimal)))
dt.Columns.Add(New DataColumn("TypeA", GetType(String)))
dt.Columns.Add(New DataColumn("Servicen", GetType(String)))
dt.Columns.Add(New DataColumn("Month", GetType(Decimal)))

if my product number = 10 ......

dr = dt.NewRow
dr(0) = "Product 10"
dr(1) = *********** Create textbox here ************
dr(2) = Prix
dr(3) = myReader.GetString(3)
dr(4) = String1
dr(5) = myReader.GetValue(4)
dt.Rows.Add(dr)

dv = New DataView(dt)
DataGrid1.DataSource = dv
DataGrid1.DataBind()


 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      03-02-2004
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Andre" <> wrote in message
news:eTcyyJV$...
> Hi,
>
> I want to add a Textbox in my datatable before binding my datagrid

with
> it. But i can't find a way to do it.
>
> Did someone know what i'm doing wrong ?
>
> - If i write <asp:textbox....> the column is empty.
> - If i create my textbox on the onitemdatabind event, my textbox is on
> another line of the datagrid.
> - if i try to make it this way my colum is empty :
> Dim txtbox As New TextBox
> txtbox.Visible = True
> txtbox.Attributes.Add("runat", "server")
> txtbox.ID = "opt"
> txtbox.EnableViewState = True
> dr(1) = txtbox
>
> Thank you, and i paste a copy of my code below.
>
>
> Dim dt As DataTable = New DataTable
> Dim dr As DataRow
> Dim dv As DataView
>
> dt.Columns.Add(New DataColumn("Service", GetType(String)))
> dt.Columns.Add(New DataColumn("Option", GetType(TextBox)))
> dt.Columns.Add(New DataColumn("Install", GetType(Decimal)))
> dt.Columns.Add(New DataColumn("TypeA", GetType(String)))
> dt.Columns.Add(New DataColumn("Servicen", GetType(String)))
> dt.Columns.Add(New DataColumn("Month", GetType(Decimal)))
>
> if my product number = 10 ......
>
> dr = dt.NewRow
> dr(0) = "Product 10"
> dr(1) = *********** Create textbox here ************
> dr(2) = Prix
> dr(3) = myReader.GetString(3)
> dr(4) = String1
> dr(5) = myReader.GetValue(4)
> dt.Rows.Add(dr)
>
> dv = New DataView(dt)
> DataGrid1.DataSource = dv
> DataGrid1.DataBind()
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
this.Controls.Add(Control) Does Not Add Control to child collection (this.Controls.Count == 0) Chad Scharf ASP .Net 3 10-18-2007 03:53 PM
Sort a datatable and create a new datatable Fredrik Rodin ASP .Net 3 09-28-2007 07:28 AM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk ASP .Net 1 10-06-2004 01:11 PM
Casting DataTable to class inherit from DataTable =?Utf-8?B?Qmx1ZWZsb3dlcg==?= ASP .Net 0 04-02-2004 05:41 AM
Adding DataTable Rows To another DataTable J. Babe ASP .Net 1 08-15-2003 05:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57