Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Accessing textbox control in a table cell

Reply
Thread Tools

Accessing textbox control in a table cell

 
 
=?Utf-8?B?QmFzcyBQcm8=?=
Guest
Posts: n/a
 
      05-18-2005
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
 
Reply With Quote
 
 
 
 
vMike
Guest
Posts: n/a
 
      05-18-2005

"Bass Pro" <> wrote in message
news:5B77B793-EAD4-4A80-8EEB-...
> 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"



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmFzcyBQcm8=?=
Guest
Posts: n/a
 
      05-19-2005
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" <> wrote in message
> news:5B77B793-EAD4-4A80-8EEB-...
> > 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"
>
>
>
>

 
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
TextBox Within Table Wider Than Cell =?Utf-8?B?QW5kcmV3IEhheWVz?= ASP .Net 3 09-28-2007 08:36 AM
add hyber link to table or table cell web control Symphony ASP .Net Web Controls 1 03-16-2005 12:30 AM
putting asp:Textbox in a asp:Table cell? Ed West ASP .Net 1 08-09-2004 08:43 AM
How do I have a table cell fetch another page to display within the cell? Phillip Roncoroni HTML 14 04-05-2004 05:58 PM
Re: VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail??? S. Justin Gengo ASP .Net 0 07-16-2003 06:51 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