473,386 Members | 1,820 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.

Adding a listitem to a table cell

Hi Everyone,

I have an array of checkboxlist. Everything works prefectly fine until I
start working on the "presentation" view. I am not able to "insert" a
checkbox item to a table cell.

Something like that,

TableCell TCell = new TableCell();

TCell.Control.Add( .....);

Is there a way to add the list item into a table cell?

Thanks!
Regards,
Hong Yip
Nov 19 '05 #1
4 2878
I might be missing your question, but you can do this:

TableCell cell = new TableCell();
CheckBox cb = new CheckBox();
cell.Controls.Add(cb);
MyTable.Rows[SomeRow].Cells.Add(cell);

Since you're dynamically creating the control, you'll have to recreate it
upon every postback if you want it to retain its state.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi Everyone,

I have an array of checkboxlist. Everything works prefectly fine until
I start working on the "presentation" view. I am not able to "insert"
a checkbox item to a table cell.

Something like that,

TableCell TCell = new TableCell();

TCell.Control.Add( .....);

Is there a way to add the list item into a table cell?

Thanks!

Regards,
Hong Yip


Nov 19 '05 #2
Thanks for Brock's suggestions.

Hi Hong,

As Brock has mentioned, we can dynamically create individual web controls
and add them in a TableCell. Also, I'm not sure whether what you want is to
add a ListItem into a TableCell? If so, I'm afraid this is not allowed
since ListItem are not a WebControl ,they must be added into an existing
ListControl. For example, we should generate a DropDownList or ListBox
control and programmly add listItem (or through databinding) to fill them ,
then add the DropDownList or ListBox into Table Cell.

Please feel free to post here if there're any further questions. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #3
Hi Brook & Steven Cheng

Thanks for the reply.

Yes, Brook, What I really want to do is to add a listitem into a TableCell.
Reason why I am putting into a TableCell is to 'tidy up' the presentation
view of my array of checkboxlist. I guess I have to look at my data
structure architecture to see if I can change it the way Brook has suggested
it.
Regards,
Hong Yip

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Xt**************@TK2MSFTNGXA01.phx.gbl...
Thanks for Brock's suggestions.

Hi Hong,

As Brock has mentioned, we can dynamically create individual web controls
and add them in a TableCell. Also, I'm not sure whether what you want is
to
add a ListItem into a TableCell? If so, I'm afraid this is not allowed
since ListItem are not a WebControl ,they must be added into an existing
ListControl. For example, we should generate a DropDownList or ListBox
control and programmly add listItem (or through databinding) to fill them
,
then add the DropDownList or ListBox into Table Cell.

Please feel free to post here if there're any further questions. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #4
OK. If there're any further questions or anything else we can help, please
feel free to post here.

Good Luck!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #5

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

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
4
by: Sandeep | last post by:
Hi I am doing one thing in my website ,actually i want to add controls dynamically to a web form and want to access the elements but when i postback the form,and access that control, it gives...
0
by: Sileesh | last post by:
Hi I have html table and a Button in an Aspx page. I am adding one row with some textboxes to Html table each time i click on the Button thru Javascript. Now problem is when when i try to...
5
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound...
2
by: dschectman | last post by:
This appears to be a feature of IE JavaScript. I am running IE 6.0 with the latest patches from Microsoft. Are there any workarounds other than re-coding the source HTML to place all the...
15
by: glenn | last post by:
Hi folks, I have a DropDownList in a DataGrid that is populated from records in a database. I want to add a value that might be a string such as "Select a Company" for the first item since an...
5
by: Mike | last post by:
In ASP.NET 2.0 I have a dropdownlist populated from a sqldatasource. The dropdownlist values are successfully populated from a database table. I would like to add the value "Select Company" which...
2
by: AlecL | last post by:
I have a page that has about 5 or 6 user controls ranging from hearders to footers to ad space but when I add a new user control which is a form it gives me the exception "page can have only one...
1
by: cleary1981 | last post by:
Hi, I am trying to add page numbers to my document in xsl fo. I can get the page numbers to work but I need them to show at the bottom of each page. I know you can define an area as region-after...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.