custom DataGrid placement on page?

Discussion in 'ASP .Net Datagrid Control' started by Andre, Oct 22, 2003.

  1. Andre

    Andre Guest

    I've searched for this but haven't found an answer.

    Is it possible to customize a datagrid's location on the page in
    run-time?

    I have two datagrids, one on top of the other. I'm not currently using
    paging as the query feeding the uppder grid is only returning the TOP
    20 records. I'd like to customize the placement of the lower datagrid
    that, if the uppder dg contains over 12 services, the lower one is
    moved downwards so many pixels for every additional row over 12.

    Thanks in advance for any suggestions or c# snippets that might be
    useful.

    Thanks,

    Andre
    Andre, Oct 22, 2003
    #1
    1. Advertising

  2. Andre

    Alvin Bruney Guest

    how about the datagrids top and left attribute
    if(DataGrid2.Height == 20)
    {
    DataGrid1.Attributes.Add("top","10");
    DataGrid1.Attributes.Add("left","10");
    }
    roughly
    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Andre" <> wrote in message
    news:...
    > I've searched for this but haven't found an answer.
    >
    > Is it possible to customize a datagrid's location on the page in
    > run-time?
    >
    > I have two datagrids, one on top of the other. I'm not currently using
    > paging as the query feeding the uppder grid is only returning the TOP
    > 20 records. I'd like to customize the placement of the lower datagrid
    > that, if the uppder dg contains over 12 services, the lower one is
    > moved downwards so many pixels for every additional row over 12.
    >
    > Thanks in advance for any suggestions or c# snippets that might be
    > useful.
    >
    > Thanks,
    >
    > Andre
    Alvin Bruney, Oct 22, 2003
    #2
    1. Advertising

  3. Andre

    Eddie B. Guest

    Place your datagrid into a HTM label (not webforms label) then you can hide
    or make it appear as well as moving location. This will also make your grid
    scrolling so you won't have to worry about paging. Good Luck!



    "Andre" <> wrote in message
    news:...
    > I've searched for this but haven't found an answer.
    >
    > Is it possible to customize a datagrid's location on the page in
    > run-time?
    >
    > I have two datagrids, one on top of the other. I'm not currently using
    > paging as the query feeding the uppder grid is only returning the TOP
    > 20 records. I'd like to customize the placement of the lower datagrid
    > that, if the uppder dg contains over 12 services, the lower one is
    > moved downwards so many pixels for every additional row over 12.
    >
    > Thanks in advance for any suggestions or c# snippets that might be
    > useful.
    >
    > Thanks,
    >
    > Andre
    Eddie B., Oct 22, 2003
    #3
  4. Andre

    Andre Guest

    That was a huge help. Thank you!!
    Andre, Oct 22, 2003
    #4
  5. Andre

    Andre Guest

    I'm afraid the solution is still eluding me, I'd appreciate some extra
    help.

    The datagrid control has the following attributes on the asp page. I'm
    trying to modify the TOP portion of the style attribute.

    <asp:datagrid id="dgScheduledToday" style="Z-INDEX: 119; LEFT: 160px;
    POSITION: absolute; TOP: 512px" runat="server" Height="60px"
    Font-Names="Arial" Font-Size="Smaller" AutoGenerateColumns="False"
    CellPadding="0" AllowSorting="True" AllowCustomPaging="True"
    BorderStyle="Dotted" Width="608px"
    PageSize="4">

    I've tried inserting the following snippet into the code-behind, but
    it has no effect on page rendering.
    dgScheduledToday.Attributes.Add("TOP: ", "700px");

    I've also tried with no success:
    dgScheduledToday.Attributes.Add("style=", "TOP: 700px");

    I've got a breakpoint set on this line and it is executing, so I can
    rule out the if() statement at this point.

    Again, Thanks.
    Andre, Oct 22, 2003
    #5
  6. Andre

    Alvin Bruney Guest

    incorrect syntax
    ("top","10")
    not ("top:","10")

    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Andre" <> wrote in message
    news:...
    > I'm afraid the solution is still eluding me, I'd appreciate some extra
    > help.
    >
    > The datagrid control has the following attributes on the asp page. I'm
    > trying to modify the TOP portion of the style attribute.
    >
    > <asp:datagrid id="dgScheduledToday" style="Z-INDEX: 119; LEFT: 160px;
    > POSITION: absolute; TOP: 512px" runat="server" Height="60px"
    > Font-Names="Arial" Font-Size="Smaller" AutoGenerateColumns="False"
    > CellPadding="0" AllowSorting="True" AllowCustomPaging="True"
    > BorderStyle="Dotted" Width="608px"
    > PageSize="4">
    >
    > I've tried inserting the following snippet into the code-behind, but
    > it has no effect on page rendering.
    > dgScheduledToday.Attributes.Add("TOP: ", "700px");
    >
    > I've also tried with no success:
    > dgScheduledToday.Attributes.Add("style=", "TOP: 700px");
    >
    > I've got a breakpoint set on this line and it is executing, so I can
    > rule out the if() statement at this point.
    >
    > Again, Thanks.
    Alvin Bruney, Oct 23, 2003
    #6
    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. Jack Stone
    Replies:
    1
    Views:
    1,223
    Symon
    Jul 25, 2003
  2. Jenny

    Popup placement

    Jenny, Aug 11, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    413
    Vidar Petursson
    Aug 15, 2003
  3. KatB
    Replies:
    1
    Views:
    582
    Lucas Tam
    Oct 5, 2004
  4. Harry
    Replies:
    0
    Views:
    286
    Harry
    Feb 1, 2007
  5. Replies:
    4
    Views:
    348
    Alf P. Steinbach
    May 21, 2006
Loading...

Share This Page