changing style from codebehind in .NET website

What am i doing wrong here... i want to change the position of a couple of items as per the code below. If the person is just a user (as opposed to an administrator) then i want to move the panel and gridview according to the positions below.

the gridview moves upwards from it's position to TOP = 150px
the panel moves left to position LEFT = 292
but the panel won't move up to position TOP = 16

what am i doing wrong there exactly?


'codebehind
If Session("Role") = "User" Then
            Panel2.Style.Add("TOP", "200")
            Panel2.Style.Add("LEFT", "292px")

            grdQueryStatus.Style.Add("TOP", "150px")

         End If

'html
<asp:Panel      ID="Panel2" runat="server" BorderStyle="Groove" Height="132px" Style="z-index: 113;
                        left: 556px; position: absolute; top: 60px" Width="336px"></asp:Panel>

<asp:GridView   ID="grdQueryStatus" runat="server" AllowPaging="True"
                        BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
                        CellPadding="3" DataSourceID="AccessDataSource3" ForeColor="Black" GridLines="Vertical"
                        PageSize="20" AllowSorting="True" AutoGenerateColumns="False" AutoGenerateSelectButton="True" style="z-index: 115; left: 11px; position: absolute; top: 233px" EnableViewState="False" Width="1300px"> <FooterStyle BackColor="#CCCCCC" />
                        <Columns></Columns>
                        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>

Open in new window

AidenAAsked:
Who is Participating?
 
conrabaConnect With a Mentor Commented:
I had a similar problem way back, Try adding "px" on the code behind declaration for top

Panel2.Style.Add("TOP", "200px")
0
 
AidenAAuthor Commented:
well done... didn't spot that at all... one of those little annoying ones!

Thanks! Aiden
0
 
AidenAAuthor Commented:
well done... didn't spot that at all... one of those little annoying ones!

Thanks! Aiden
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.