473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Accessing textbox control in a table cell

How do I access a textbox when it was added to a table cell?
I've tried using the findcontrol function with no result.

I create it as such...
Dim myTable As Table = New Table
Dim Row as TableRow

row = New TableRowI
Answer_1 = New TextBox
Answer_1.Width = New Unit("100px")
Answer_1.Text = " "
cell = New TableCell
cell.Controls.Add(Answer_1)
row.Cells.Add(cell)
myTable.Rows.Add(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard.FindControl("myTable" &
CStr(QuestionTypeID)), Table)

tb = CType(tl.Rows(0).Cells(0).FindControl("Answer_1"),
TextBox)
and it doesn't. tb is always "Nothing".

Where am I wrong?
TIA.
--
Bill Jones
Nov 19 '05 #1
2 2775

"Bass Pro" <Ba*****@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
How do I access a textbox when it was added to a table cell?
I've tried using the findcontrol function with no result.

I create it as such...
Dim myTable As Table = New Table
Dim Row as TableRow

row = New TableRowI
Answer_1 = New TextBox
Answer_1.Width = New Unit("100px")
Answer_1.Text = " "
cell = New TableCell
cell.Controls.Add(Answer_1)
row.Cells.Add(cell)
myTable.Rows.Add(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard.FindControl("myTable" &
CStr(QuestionTypeID)), Table)

tb = CType(tl.Rows(0).Cells(0).FindControl("Answer_1"), TextBox)
and it doesn't. tb is always "Nothing".

Where am I wrong?
TIA.
--
Bill Jones


I don't see were you are giving the textbox an id as in
Answer_1.ID="Answer_1"

Nov 19 '05 #2
I do it when I dynanmically create the table control.

The table is placed on a panel control dynamically based on parameters to
the type of question template selected by the admin user. I'm trying t
create a "Range" type answer where there is an "Answer_1" and an "Answer_2"
box the end user fills in. The number of possible options are unknown at
design time, so it has to be done dynamically.
Txs,
--
Bill Jones
"vMike" wrote:

"Bass Pro" <Ba*****@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
How do I access a textbox when it was added to a table cell?
I've tried using the findcontrol function with no result.

I create it as such...
Dim myTable As Table = New Table
Dim Row as TableRow

row = New TableRowI
Answer_1 = New TextBox
Answer_1.Width = New Unit("100px")
Answer_1.Text = " "
cell = New TableCell
cell.Controls.Add(Answer_1)
row.Cells.Add(cell)
myTable.Rows.Add(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard.FindControl("myTable" &
CStr(QuestionTypeID)), Table)

tb =

CType(tl.Rows(0).Cells(0).FindControl("Answer_1"),
TextBox)
and it doesn't. tb is always "Nothing".

Where am I wrong?
TIA.
--
Bill Jones


I don't see were you are giving the textbox an id as in
Answer_1.ID="Answer_1"

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jurjen de Groot | last post by:
I'm developing a ASP.NET/VB.NET web application. (VS.NET 2003) I've created several webpages, but on two pages one textbox colors yellow (the background) and I can't get the background to appear...
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
1
by: Ed West | last post by:
Hello, How can I put a textbox control into a cell of an asp:Table? I was not able to do it from the properties sheet, so I put it in via html tab, but now I can't select it from the Design tab...
3
by: nvx | last post by:
Hello everyone... Just for the record, I'm a newbie to this data binding thing... In my C# application I need to bind a cell of an Access database table to a multiline TextBox. How should I do...
3
by: Sam | last post by:
Hi all, Would some one tell me why the value of the e.Item.Cells(index).Text argument in my datagrid control update event is empty even though I have it populated? If I want to know a value of a...
4
by: ally | last post by:
In VB 2K5 Express I've created a panel named "Configure" with eight label, and eight combobox controls; and finally a button named "Apply." The label controls are sequentially named Channel0...
3
by: rn5a | last post by:
A DataGrid has a BoundColumn, an EditCommandColumn & a few TemplateColumns. When the text in the EditCommandColumn within any of the DataGridItems is clicked, the corresponding BoundColumn changes...
7
by: robert.waters | last post by:
I have an Access database frontend linked via ODBC to a large (gigabytes) mysql database. I need to view a large amount of data in a a textbox (variable up to 300K), but I receive a 'there isnt...
1
by: bgernon | last post by:
I have a table that consists of two rows with three cells each row. The cells contain textboxes. I am able to successfully add a new row with textboxes when a button is clicked. The problem is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.