473,800 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "presentati on" view. I am not able to "insert" a
checkbox item to a table cell.

Something like that,

TableCell TCell = new TableCell();

TCell.Control.A dd( .....);

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

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

TableCell cell = new TableCell();
CheckBox cb = new CheckBox();
cell.Controls.A dd(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 "presentati on" view. I am not able to "insert"
a checkbox item to a table cell.

Something like that,

TableCell TCell = new TableCell();

TCell.Control.A dd( .....);

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.m icrosoft.com> wrote in message
news:Xt******** ******@TK2MSFTN GXA01.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
5483
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 dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
4
1602
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 error Object reference not set to an instance of an object. ************************************************************************ ************************************************************************** Public Class index2 Inherits...
0
1880
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 collect the data in the Textboxes which i added dynamically from server side, i am not able to do . Alos i tried to bedug, the total no of rows in Html table does not reflect the dynamically added rows.
5
4666
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 combo by allowing the user to dynamically type in the new value directly in the combo box whcih in turn updates the lookup table and then when they have finished leaves that particular cell on the grid with the correct value. Seems...
2
4965
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 non-visible columns at the front? I have a page with a dynamic table. The table has some visible columns and some non-visible columns. The style "hide" is .hide { display:none; } <table id="SelectedList">
15
3132
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 OnSelectedIndex event is not fired if you select the first item. Does anyone know of an easy way to do this?
5
17169
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 will be the selected value when the page loads. I attempted to use the code below to add "Select Company" dynamically but it is not added. Only the values from the database are in the dropdownlist. I also tried to added it to the dropdownlist...
2
1886
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 server-side Form tag" error. Here is the brief code that I am adding to the code: on top: <%@ Register TagPrefix="uc" TagName="CareerStats" Src="/Controls/CareerStats.ascx" %> and the div where I added the control:
1
5326
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 but don't know how. Heres my xsl file so far. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" ...
0
9690
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.