473,396 Members | 1,826 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,396 software developers and data experts.

Extend TableCell

I have an aspx page with a huge ASP Table in it. I need to add some
properties to its TableCells, but the table was cerated with the
designer, and not with custom code.
I can create a "MyTableCell" that extends from TableCell and add the
properties I want, but how can I change the ASP Table to use
MyTableCell instead of the default TableCell class for the cells?

Thanks

Apr 4 '06 #1
1 1405
Whether you use a Designer to create the table or not is not relevant, other
than the fact that in order to do what you want, you will have to go beyond
the Designer to do it.

You have a couple of alternatives, depending upon what you want to do with
it. First, since your TableCell class inherits TableCell, you can manually
add these to a Table, as in:

<asp:table id="Table1" runat="server" CellPadding="3" CellSpacing="3">
<asp:TableRow>
<myPrefix:myTableCell Text="(0,0)"></myPrefix:myTableCell>
<myPrefix:myTableCell Text="(0,1)"></myPrefix:myTableCell>
<myPrefix:myTableCell Text="(0,2)"></myPrefix:myTableCell>
</asp:TableRow>
<asp:TableRow>
<myPrefix:myTableCell Text="(1,0)"></myPrefix:myTableCell>
<myPrefix:myTableCell Text="(1,1)"></myPrefix:myTableCell>
<myPrefix:myTableCell Text="(1,2)"></myPrefix:myTableCell>
</asp:TableRow>
</asp:table>

You will need to do some casting in your code to get at the new properties
in the cells. You may need to code the creation of the Table, depending upon
your requirements.

Second, you can create inherited Table and TableRow classes which work
directly with your new class.

Finally, you can go all the way and create a Designer for the whole thing if
you like.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Matthi" <hu************@cgd.pt> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
I have an aspx page with a huge ASP Table in it. I need to add some
properties to its TableCells, but the table was cerated with the
designer, and not with custom code.
I can create a "MyTableCell" that extends from TableCell and add the
properties I want, but how can I change the ASP Table to use
MyTableCell instead of the default TableCell class for the cells?

Thanks

Apr 4 '06 #2

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

Similar topics

0
by: Randy | last post by:
Hello All, Is there any way to make this happen... Say I want to make a table with 3 rows. The first row has two TableCells each with a width of 300. The second row has one TableCell with the...
4
by: Serdar Kalaycý | last post by:
I create a TableCell by TableCell cell = new TableCell() but I could not find how to add a TextBox inside this cell. Any ideas? Thanks in advance Serdar KALAYCI --
2
by: George Durzi | last post by:
Consider this pseudo HTML from a web form <asp:Table> <asp:TableRow> <asp:TableCell> <asp:Table> <asp:TableRow> <asp:TableCell></asp:TableCell> <asp:TableCell></asp:TableCell>...
6
by: Mr. x | last post by:
Hello, I have the following aspx code : <form id = "main_form" runat = "server"> <asp:Table dir = "rtl" runat = "server"> <asp:TableRow> <asp:TableCell id =...
3
by: Andre | last post by:
Hi, Did someone know why this code does'nt work (The TableCell Width). The cell don't have 600 and 150 like writed in width="600" and width="150". <asp:datagrid id="DataGrid1" ...
6
by: hb | last post by:
Hi, I have a page bill.aspx and its code-behind bill.aspx.cs. On bill.aspx I have: === Select a month: <asp:dropdownlist runat="server" id="lstDate" autopostback="True" /> <br> <asp:table...
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
2
by: Amelyan | last post by:
If I have spaces in my Text property of Label, and I add it to TableCell, it wraps at spaces. E.g. Label lb = new Label(); lb.Text = "Hello, World!" TableCell cell = new TableCell();...
0
by: DanG | last post by:
During grid field validation, I would like to generate a message for the user to tell which column had the error. So I have a control (textbox, dropdownlist, checkbox, etc.), and would like to...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...
0
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...

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.