By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

Access TextBox.Text inside a Dynamically Created Table

P: n/a
I'm using a table (dynamically generated at runtime) for formatting wherein I have text in the first column, and textboxes in the second column. For example, (1,1) might have the string "Last Name" and (1,2) has a textbox where the user can type the last name; (2,1) "First Name", and (2,2) a textbox, and so forth. The code to it is:

dim table_test As System.Web.UI.WebControls.Table

For rowCount = 0 To 3
Dim column1 As New TableCell()
Dim column2 As New TableCell()
Dim row As New TableRow()

column1.Controls.Add(New LiteralControl("something"))
column2.Controls.Add(New TextBox())

row.Cells.Add(column1)
row.Cells.Add(column2)

table_test.Rows.Add(row)
Next

Once the table is generated, and presented, how can I fetch the contents of the textboxes in the second column? The following does not work because I don't want the text within the cell, I want the text within the textbox within the cell (I'm assuming the rows and cells are zero origined, I might be wrong):

dim s as string
s = table_test.rows(0).cells(1).text

Any suggestions will be greatly appreciated!
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
This is not really the right newsgroup for this question you should have
placed it in ASPNET. However, dont do it this way. just use a datagrid, much
easier.

Regards - OHM
"Newbee" <an*******@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
I'm using a table (dynamically generated at runtime) for formatting wherein I have text in the first column, and textboxes in the second column.
For example, (1,1) might have the string "Last Name" and (1,2) has a textbox
where the user can type the last name; (2,1) "First Name", and (2,2) a
textbox, and so forth. The code to it is:
dim table_test As System.Web.UI.WebControls.Table

For rowCount = 0 To 3
Dim column1 As New TableCell()
Dim column2 As New TableCell()
Dim row As New TableRow()

column1.Controls.Add(New LiteralControl("something"))
column2.Controls.Add(New TextBox())

row.Cells.Add(column1)
row.Cells.Add(column2)

table_test.Rows.Add(row)
Next

Once the table is generated, and presented, how can I fetch the contents of the textboxes in the second column? The following does not work because I
don't want the text within the cell, I want the text within the textbox
within the cell (I'm assuming the rows and cells are zero origined, I might
be wrong):
dim s as string
s = table_test.rows(0).cells(1).text

Any suggestions will be greatly appreciated!

Nov 20 '05 #2

P: n/a
Cor
Hi OHM,

In my opinion is this on the edge if this is not the right newsgroup, but I
would not have answered this if it was not your first datagrid web answer.

:-))))))

Cor
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.