custom DataGrid placement on page?

A

Andre

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
 
A

Alvin Bruney

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

Eddie B.

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!
 
A

Andre

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top