Set html table width at run time (in code)

Discussion in 'ASP .Net' started by ruca, Jul 21, 2004.

  1. ruca

    ruca Guest

    Hi

    How can I get a html control in my code?
    I have a html table that I want the width is defined in code at run time,
    i.e., I have this table and I have a datagrid. This datagrid have a variable
    width because the number of columns depends of something that I have (that
    is not important for this). Now, what I want is that the html table have
    always the same width of my datagrid because of alignment of both.

    NOTE: I must have (and want) the datagrid width variable and not fixed


    --
    Programming ASP.NET with VB.NET
    Thank's (if you try to help me)
    Hope this help you (if I try to help you)
    ruca
     
    ruca, Jul 21, 2004
    #1
    1. Advertising

  2. set its attribute runat=server, but you'll probably still have problems
    while tables align width depending on its content... You can hardly create
    different tables with same width. The only chance is when content never
    exceedes desired table (or better said cell) width.

    --
    RobertK
    { Clever? No just smart. }

    "ruca" <> wrote in message
    news:...
    > Hi
    >
    > How can I get a html control in my code?
    > I have a html table that I want the width is defined in code at run time,
    > i.e., I have this table and I have a datagrid. This datagrid have a

    variable
    > width because the number of columns depends of something that I have (that
    > is not important for this). Now, what I want is that the html table have
    > always the same width of my datagrid because of alignment of both.
    >
    > NOTE: I must have (and want) the datagrid width variable and not fixed
    >
    >
    > --
    > Programming ASP.NET with VB.NET
    > Thank's (if you try to help me)
    > Hope this help you (if I try to help you)
    > ruca
    >
    >
     
    Robert Koritnik, Jul 21, 2004
    #2
    1. Advertising

  3. ruca

    ruca Guest

    Thanks
    Now, how can I get the widht value at run time of a datagrid?

    I have this:
    Dim dgPx As Unit
    dgPx = myDataGrid.Width()

    But dgPx.Value does not have the value of the grid after binding grid.
    Can you help?


    --
    Programming ASP.NET with VB.NET
    Thank's (if you try to help me)
    Hope this help you (if I try to help you)
    ruca

    "Robert Koritnik" <> escreveu na
    mensagem news:%...
    > set its attribute runat=server, but you'll probably still have problems
    > while tables align width depending on its content... You can hardly create
    > different tables with same width. The only chance is when content never
    > exceedes desired table (or better said cell) width.
    >
    > --
    > RobertK
    > { Clever? No just smart. }
    >
    > "ruca" <> wrote in message
    > news:...
    > > Hi
    > >
    > > How can I get a html control in my code?
    > > I have a html table that I want the width is defined in code at run

    time,
    > > i.e., I have this table and I have a datagrid. This datagrid have a

    > variable
    > > width because the number of columns depends of something that I have

    (that
    > > is not important for this). Now, what I want is that the html table have
    > > always the same width of my datagrid because of alignment of both.
    > >
    > > NOTE: I must have (and want) the datagrid width variable and not fixed
    > >
    > >
    > > --
    > > Programming ASP.NET with VB.NET
    > > Thank's (if you try to help me)
    > > Hope this help you (if I try to help you)
    > > ruca
    > >
    > >

    >
    >
     
    ruca, Jul 21, 2004
    #3
  4. You will have to set that. I told you in my first answer this is a tough
    one. The best suggestion I could give you is to put both (table and
    Datagrid) inside another table set both control's width to 100%. They would
    perfectly align and everything will depend on the width of the containing
    table cell.

    And you probably won't have to wory about widths of both parts of the
    page... Or better said tables, while a datagris is also a table.

    --
    RobertK
    { Clever? No just smart. }


    "ruca" <> wrote in message
    news:...
    > Thanks
    > Now, how can I get the widht value at run time of a datagrid?
    >
    > I have this:
    > Dim dgPx As Unit
    > dgPx = myDataGrid.Width()
    >
    > But dgPx.Value does not have the value of the grid after binding grid.
    > Can you help?
    >
    >
    > --
    > Programming ASP.NET with VB.NET
    > Thank's (if you try to help me)
    > Hope this help you (if I try to help you)
    > ruca
    >
    > "Robert Koritnik" <> escreveu na
    > mensagem news:%...
    > > set its attribute runat=server, but you'll probably still have problems
    > > while tables align width depending on its content... You can hardly

    create
    > > different tables with same width. The only chance is when content never
    > > exceedes desired table (or better said cell) width.
    > >
    > > --
    > > RobertK
    > > { Clever? No just smart. }
    > >
    > > "ruca" <> wrote in message
    > > news:...
    > > > Hi
    > > >
    > > > How can I get a html control in my code?
    > > > I have a html table that I want the width is defined in code at run

    > time,
    > > > i.e., I have this table and I have a datagrid. This datagrid have a

    > > variable
    > > > width because the number of columns depends of something that I have

    > (that
    > > > is not important for this). Now, what I want is that the html table

    have
    > > > always the same width of my datagrid because of alignment of both.
    > > >
    > > > NOTE: I must have (and want) the datagrid width variable and not fixed
    > > >
    > > >
    > > > --
    > > > Programming ASP.NET with VB.NET
    > > > Thank's (if you try to help me)
    > > > Hope this help you (if I try to help you)
    > > > ruca
    > > >
    > > >

    > >
    > >

    >
    >
     
    Robert Koritnik, Jul 21, 2004
    #4
  5. One doesn't do this sort of things in the code. Put both the table and the
    grid in another table as it's been suggested in another reply.

    Eliyahu

    "ruca" <> wrote in message
    news:...
    > Hi
    >
    > How can I get a html control in my code?
    > I have a html table that I want the width is defined in code at run time,
    > i.e., I have this table and I have a datagrid. This datagrid have a

    variable
    > width because the number of columns depends of something that I have (that
    > is not important for this). Now, what I want is that the html table have
    > always the same width of my datagrid because of alignment of both.
    >
    > NOTE: I must have (and want) the datagrid width variable and not fixed
    >
    >
    > --
    > Programming ASP.NET with VB.NET
    > Thank's (if you try to help me)
    > Hope this help you (if I try to help you)
    > ruca
    >
    >
     
    Eliyahu Goldin, Jul 21, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    808
    Bruce Barker
    Oct 10, 2005
  2. Sean Jorden
    Replies:
    1
    Views:
    609
    laurie
    Aug 19, 2003
  3. Steve Richter
    Replies:
    2
    Views:
    7,956
    Steve Richter
    Jun 15, 2007
  4. Pierre Yves
    Replies:
    2
    Views:
    500
    Pierre Yves
    Jan 10, 2008
  5. ruca

    Set html table width at run time (in code)

    ruca, Jul 21, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    237
    Eliyahu Goldin
    Jul 21, 2004
Loading...

Share This Page