Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vpravin - 13 Jun 2007 15:54 GMT
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
Peter Bromberg [C# MVP] - 13 Jun 2007 17:31 GMT
Actually, you not only don't have a datagrid, you don't even have a Panel in
your Table. The closing </table> tag 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

> Hi guys...i am a super noob with html and aspx..
>
[quoted text clipped - 80 lines]
> just a panel; and a table inside it..
> and i add rows to it
vpravin - 13 Jun 2007 19:19 GMT
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
Mike - 13 Jun 2007 20:39 GMT
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>

>I have tried this and it hasnt worked not worked
>
[quoted text clipped - 33 lines]
> i am pretty sure that the table is inside the panel/..
> thts how i see it on the design view in visual studio
vpravin - 13 Jun 2007 21:06 GMT
cud it be tht this is more complicated bcuz i am creating/adding the
rows dynamically.?
Mike - 14 Jun 2007 18:16 GMT
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

> cud it be tht this is more complicated bcuz i am creating/adding the
> rows dynamically.?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.