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

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="regulatoryDetails" runat="server" Font-Size="X-Small"
Width="400px" Height="8px"
CellPadding="0" CellSpacing="0" CssClass="regular"
HorizontalAlign="Center"></asp:Table></P>
</asp:panel><asp:panel id="Panel4" style="Z-INDEX: 103; LEFT: 16px;
POSITION: absolute; TOP: 16px" runat="server"
CssClass="regular" BorderWidth="1px" BorderStyle="Solid"
BorderColor="#463E41" 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_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
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_ItemCreated(tablename, ???)

....

This is the code at the start of the program

Protected WithEvents serviceProviders As
System.Web.UI.WebControls.Table
Protected WithEvents strategyAndStyles As
System.Web.UI.WebControls.Table
Protected WithEvents details As System.Web.UI.WebControls.Table

........

thats how i add cells to the table

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

titleCell.CssClass = "regular"

valueCell.Text = style

valueCell.CssClass = "regular"

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

If Me.regulatoryDetailsSortColumn = "Strategy" Then

titleCell.CssClass = titleCell.CssClass & " " & "sorted"

ElseIf Me.regulatoryDetailsSortColumn = "Style" Then

valueCell.CssClass = valueCell.CssClass & " " & "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(titleCell)

r.Cells.Add(valueCell)

Me.strategyAndStyles.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 1928
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="regulatoryDetails" runat="server" Font-Size="X-Small"
Width="400px" Height="8px"
CellPadding="0" CellSpacing="0" CssClass="regular"
HorizontalAlign="Center"></asp:Table></P>
</asp:panel><asp:panel id="Panel4" style="Z-INDEX: 103; LEFT: 16px;
POSITION: absolute; TOP: 16px" runat="server"
CssClass="regular" BorderWidth="1px" BorderStyle="Solid"
BorderColor="#463E41" 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_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
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_ItemCreated(tablename, ???)

....

This is the code at the start of the program

Protected WithEvents serviceProviders As
System.Web.UI.WebControls.Table
Protected WithEvents strategyAndStyles As
System.Web.UI.WebControls.Table
Protected WithEvents details As System.Web.UI.WebControls.Table

........

thats how i add cells to the table

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

titleCell.CssClass = "regular"

valueCell.Text = style

valueCell.CssClass = "regular"

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

If Me.regulatoryDetailsSortColumn = "Strategy" Then

titleCell.CssClass = titleCell.CssClass & " " & "sorted"

ElseIf Me.regulatoryDetailsSortColumn = "Style" Then

valueCell.CssClass = valueCell.CssClass & " " & "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(titleCell)

r.Cells.Add(valueCell)

Me.strategyAndStyles.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.CssClass =titleCell.CssClass & " titlewidth"

valueCell.CssClass =valueCell.CssClass & " 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.CssClass = "regular titlewidth"
valueCell.Text = style
valueCell.CssClass = "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:TableCell Width="100px">This 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:TableCell Width="100px" CssClass="yourStyles">This is a
test table Giddy UP!</asp:TableCell>
</asp:TableRow>
</asp:Table>


"vpravin" <vp****@gmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.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.CssClass =titleCell.CssClass & " titlewidth"

valueCell.CssClass =valueCell.CssClass & " 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.CssClass = "regular titlewidth"
valueCell.Text = style
valueCell.CssClass = "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.comwrote in message
news:11**********************@z28g2000prd.googlegr oups.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
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...
3
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...
3
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(...
3
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...
3
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...
6
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...
2
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...
4
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...
5
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.