473,769 Members | 5,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Column Widths...NOT a DATAGRID..Just A table

Hi guys...i am a super noob with html and aspx..

i didnt start this project but i am modifying it...

q: how do i change the width of a column:

Thats the table which is within a text box

<asp:Table id="regulatoryD etails" runat="server" Font-Size="X-Small"
Width="400px" Height="8px"
CellPadding="0" CellSpacing="0" CssClass="regul ar"
HorizontalAlign ="Center"></asp:Table></P>
</asp:panel><asp: panel id="Panel4" style="Z-INDEX: 103; LEFT: 16px;
POSITION: absolute; TOP: 16px" runat="server"
CssClass="regul ar" BorderWidth="1p x" BorderStyle="So lid"
BorderColor="#4 63E41" Height="176px" Width="404px"
Font-Size="X-Small">
<P>



...

i went to the FAQ of this forum and saw the post about changingf
column widths...

it sent me to a KB article which asked me to do this:

Private Sub DataGrid1_ItemC reated(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs)
e.Item.Cells(0) .Width = New Unit(264)
e.Item.Cells(1) .Width = New Unit(264)
End Sub

....now my q is..when i call teh function..what do i put in
DataGrid1_ItemC reated(tablenam e, ???)

....

This is the code at the start of the program

Protected WithEvents serviceProvider s As
System.Web.UI.W ebControls.Tabl e
Protected WithEvents strategyAndStyl es As
System.Web.UI.W ebControls.Tabl e
Protected WithEvents details As System.Web.UI.W ebControls.Tabl e

........

thats how i add cells to the table

Dim titleCell As New TableCell, valueCell As New TableCell
titleCell.Text = strategies

titleCell.CssCl ass = "regular"

valueCell.Text = style

valueCell.CssCl ass = "regular"

'if a sort column is specified for and of the column, add the 'sorted'
css class laso to that column

If Me.regulatoryDe tailsSortColumn = "Strategy" Then

titleCell.CssCl ass = titleCell.CssCl ass & " " & "sorted"

ElseIf Me.regulatoryDe tailsSortColumn = "Style" Then

valueCell.CssCl ass = valueCell.CssCl ass & " " & "sorted"

End If

'create the rows for the cells created and add the rows to the
regylatory details table

Dim r As New TableRow
r.Cells.Add(tit leCell)

r.Cells.Add(val ueCell)

Me.strategyAndS tyles.Rows.Add( r)

NOTE>...I DONT HAVE A DATAGRID in the table...
just a panel; and a table inside it..
and i add rows to it

Jun 13 '07 #1
5 1955
Actually, you not only don't have a datagrid, you don't even have a Panel in
your Table. The closing </tabletag occurs BEFORE the panel. You need this
stuff to go inside the table tags before you can even start to fix it. And,
your table is going to need at least "one" table row, and at least one "TD"-
cell inside it.

-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"vpravin" wrote:
Hi guys...i am a super noob with html and aspx..

i didnt start this project but i am modifying it...

q: how do i change the width of a column:

Thats the table which is within a text box

<asp:Table id="regulatoryD etails" runat="server" Font-Size="X-Small"
Width="400px" Height="8px"
CellPadding="0" CellSpacing="0" CssClass="regul ar"
HorizontalAlign ="Center"></asp:Table></P>
</asp:panel><asp: panel id="Panel4" style="Z-INDEX: 103; LEFT: 16px;
POSITION: absolute; TOP: 16px" runat="server"
CssClass="regul ar" BorderWidth="1p x" BorderStyle="So lid"
BorderColor="#4 63E41" Height="176px" Width="404px"
Font-Size="X-Small">
<P>



...

i went to the FAQ of this forum and saw the post about changingf
column widths...

it sent me to a KB article which asked me to do this:

Private Sub DataGrid1_ItemC reated(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs)
e.Item.Cells(0) .Width = New Unit(264)
e.Item.Cells(1) .Width = New Unit(264)
End Sub

....now my q is..when i call teh function..what do i put in
DataGrid1_ItemC reated(tablenam e, ???)

....

This is the code at the start of the program

Protected WithEvents serviceProvider s As
System.Web.UI.W ebControls.Tabl e
Protected WithEvents strategyAndStyl es As
System.Web.UI.W ebControls.Tabl e
Protected WithEvents details As System.Web.UI.W ebControls.Tabl e

........

thats how i add cells to the table

Dim titleCell As New TableCell, valueCell As New TableCell
titleCell.Text = strategies

titleCell.CssCl ass = "regular"

valueCell.Text = style

valueCell.CssCl ass = "regular"

'if a sort column is specified for and of the column, add the 'sorted'
css class laso to that column

If Me.regulatoryDe tailsSortColumn = "Strategy" Then

titleCell.CssCl ass = titleCell.CssCl ass & " " & "sorted"

ElseIf Me.regulatoryDe tailsSortColumn = "Style" Then

valueCell.CssCl ass = valueCell.CssCl ass & " " & "sorted"

End If

'create the rows for the cells created and add the rows to the
regylatory details table

Dim r As New TableRow
r.Cells.Add(tit leCell)

r.Cells.Add(val ueCell)

Me.strategyAndS tyles.Rows.Add( r)

NOTE>...I DONT HAVE A DATAGRID in the table...
just a panel; and a table inside it..
and i add rows to it

Jun 13 '07 #2
I have tried this and it hasnt worked not worked
"
Ok, You need to uniquly identify the two columns, by adding an
additional class:

titleCell.CssCl ass =titleCell.CssC lass & " titlewidth"

valueCell.CssCl ass =valueCell.CssC lass & " valuewidth"

Then in CSS add the following:

td.titlewidth{
width:100px;
}

td.valuewidth{
width:200px;
}

**UPDATE**

Its tidier to modify the code as shown below then add-in the CSS:

Dim titleCell As New TableCell, valueCell As New TableCell
titleCell.Text = strategies
titleCell.CssCl ass = "regular titlewidth"
valueCell.Text = style
valueCell.CssCl ass = "regular valuewidth"

NB: the space is important!
""

---

i am pretty sure that the table is inside the panel/..
thts how i see it on the design view in visual studio

Jun 13 '07 #3
start with this and modify it as you see fit:
<asp:Table ID="tbl1" Width="100%" runat="server">
<asp:TableRow >
<asp:TableCel l Width="100px">T his is a test table Giddy
UP!</asp:TableCell>
</asp:TableRow>
</asp:Table>

if your using a style sheet then do this:

<asp:Table ID="tbl1" Width="100%" runat="server">
<asp:TableRow >
<asp:TableCel l Width="100px" CssClass="yourS tyles">This is a
test table Giddy UP!</asp:TableCell>
</asp:TableRow>
</asp:Table>


"vpravin" <vp****@gmail.c omwrote in message
news:11******** *************@i 13g2000prf.goog legroups.com...
>I have tried this and it hasnt worked not worked
"
Ok, You need to uniquly identify the two columns, by adding an
additional class:

titleCell.CssCl ass =titleCell.CssC lass & " titlewidth"

valueCell.CssCl ass =valueCell.CssC lass & " valuewidth"

Then in CSS add the following:

td.titlewidth{
width:100px;
}

td.valuewidth{
width:200px;
}

**UPDATE**

Its tidier to modify the code as shown below then add-in the CSS:

Dim titleCell As New TableCell, valueCell As New TableCell
titleCell.Text = strategies
titleCell.CssCl ass = "regular titlewidth"
valueCell.Text = style
valueCell.CssCl ass = "regular valuewidth"

NB: the space is important!
""

---

i am pretty sure that the table is inside the panel/..
thts how i see it on the design view in visual studio

Jun 13 '07 #4
cud it be tht this is more complicated bcuz i am creating/adding the
rows dynamically.?

Jun 13 '07 #5
No, because once you set the width it should be set no matter how your
setting the rows. Show all of your HTML code for your table. Let can help
me see what your doing and having issues with.

Though you may be better off using a grid, that renders a HTML table but you
can 'customize' it a little easier then with a asp:table in the HTML. You
may have a syntax error in the HTML and that can break your table's layout.
Show your HTML
"vpravin" <vp****@gmail.c omwrote in message
news:11******** **************@ z28g2000prd.goo glegroups.com.. .
cud it be tht this is more complicated bcuz i am creating/adding the
rows dynamically.?

Jun 14 '07 #6

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

Similar topics

3
10715
by: Steve Sabljak | last post by:
I seem to having a little trouble getting a table to display correctly in both msie and firefox. I want to set the table and column widths in pixels, and have some cell padding too. The table displays correctly in standards compiance mode in firefox, but not msie, where the padding is added on to the column widths. the table size is always correct, but the column widths are not what I expect them to be. If I change the column widths to...
3
3360
by: Shravan Kumar | last post by:
Hi, I am using my code to set column widths of datagrid columns dynamically, but when I am setting the column widths to zero, the header text of the column whose width is made to zero is appearing on the existing column headers, and the text gets blurred with the painting of the column text along with the adjacent width 0 column. Anybody, can you please give me a solution for it
3
5375
by: bismarkjoe | last post by:
Hello, I am trying to set the widths on the columns of a DataGrid component, and I'm not sure if I'm doing it correctly. My code is below: //load some inital data table = db.GetDataTable( "SELECT 'Task' AS 'Type', title AS 'Title', IFNULL(u.name, 'Nobody') AS 'Assigned To' FROM tasks t LEFT JOIN users u ON t.assigned_to=u.user_id LIMIT 0, 30" ); grid.ReadOnly = true;
3
7895
by: jason | last post by:
I'll try to explain in detail what it is I'm struggling with. I created a SQL database with one table called CallSheet which contains the following columns: Caller ID: <--Primary Key, auto indexed by my SQL server From: Company: Status: Date: Phone Primary:
3
6477
by: Mike Fellows | last post by:
Im trying to set the column width of individual datgrid columns I can set the column widths of all the columns at once using Me.DataGrid1.PreferredColumnWidth = 100 But I am unable to set the individual column widths Also the source from where my data is coming from the first column contains a date and time i.e. 01/01/2003 12:00:00 but within the datagrid it displays 01/01/2003 and i need it
6
7108
by: cr113 | last post by:
I'm trying to set the column widths for a datagrid. You'd think it would be easy. I looked it up in google and the first thing I found looked promising: datagrid1.columns(0).width = 2000 datagrid1.columns(1).width = 1000 Except that there is no such things as a columns collection in a datagrid.
2
1843
by: Ben | last post by:
Could someone please tell me why couldn't I adjust my column/row properties of my dataGrid? I binded my table, created a new DataGridTableStyle and mapped it to my datagrid. However, my columns width wouldn't changed at all. I am sure this is very easy thing to figure out but I just couldn't see it. Could you please take a look at my codes. What I am missing? Btw, I got these codes from MSDN website: thanks. .....
4
4194
by: Rich | last post by:
Hello, I have a one datagrid that will be based on different datatables. One datatable may have 7 columns, another 15... With the tables that have more columns, I have been manually dragging column widths to narrow them. I want to record these widths so I can reapply them when I bind the datagrid to the table with 15 columns. I have searched around for articles on this and saw some that talked about...
5
3508
by: Roger | last post by:
I am trying to do a 'simple' task in a DGV control. The problem is this. I have an unbound DGV with all 'AllowUser' options disabled. RowHeader.Visible=False ColumnHeader.Text is labelled as needed. For simplicity the DGV has 7 columns and 15 rows. The 15 rows are populated and the DGV is made visible. Everything is just fine. But now I want rows 6,7 and 11,12 to have different column spacing to the other rows.
0
9589
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
9423
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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
8872
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
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
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.