473,587 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.A dd(Answer_1)
row.Cells.Add(c ell)
myTable.Rows.Ad d(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard. FindControl("my Table" &
CStr(QuestionTy peID)), Table)

tb = CType(tl.Rows(0 ).Cells(0).Find Control("Answer _1"),
TextBox)
and it doesn't. tb is always "Nothing".

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

"Bass Pro" <Ba*****@discus sions.microsoft .com> wrote in message
news:5B******** *************** ***********@mic rosoft.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.A dd(Answer_1)
row.Cells.Add(c ell)
myTable.Rows.Ad d(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard. FindControl("my Table" &
CStr(QuestionTy peID)), Table)

tb = CType(tl.Rows(0 ).Cells(0).Find Control("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="An swer_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*****@discus sions.microsoft .com> wrote in message
news:5B******** *************** ***********@mic rosoft.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.A dd(Answer_1)
row.Cells.Add(c ell)
myTable.Rows.Ad d(row)
myTable.ID = "myTable5"
I expected this to work:
tl = CType(pnlBoard. FindControl("my Table" &
CStr(QuestionTy peID)), Table)

tb =

CType(tl.Rows(0 ).Cells(0).Find Control("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="An swer_1"

Nov 19 '05 #3

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

Similar topics

4
6894
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 as White as it should by default. Even setting the background to Red doesn't prevent it, the textbox still appears with a yellow background. With or...
2
2914
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 a WebForm with some textboxes, dropdownlists, a panel, imagebutton and so on. When I click on the image button (which was created at design time) I...
1
12247
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 (nor select it from the Properties tab on the right). Any ideas? <asp:Table id="Table1" runat="server"> <asp:TableRow> <asp:TableCell...
3
2985
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 it? I've tried to bind the TextBox using the VS IDE (which ended up in binding to a table column). This was perfect until I used the Update...
3
1412
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 cell in my datagrid control, it it better to use this expression "MyString = Ctype(e.Item.cells(index).Controls(0), textbox).text" or this...
4
1230
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 through Channel7, and the combobox controls are sequentially named Ch0 through Ch7, accordingly. Each combobox contains four items out of which one...
3
3723
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 to a TextBox. How do I get the ID of such a TextBox?
7
2886
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 enough memory' error whenever I scroll past N number of bytes in a textbox that has been filled with a lot of data. I am not sure what N is, but for...
1
2050
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 retaining the newly added row with the filled in textboxes on the next button click. I think I am handling my viewstate incorrectly. This code adds...
0
7923
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.