Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When there are rows in Gridview1, the button3 position works according to the size of the GV.
When there are no rows in the GV , the BTN3 location is changed and displays somewhere else.
I have put both the GV and BTN in same
. How to maintain the location of BTN3 even if the GV is empty.

The following is the code:

CSS
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
 style=" left: 500px; margin-top:23%;  height: 105px; width: 590px; background-color: #ECE9D8;"
 HorizontalAlign="Center" BorderColor="Maroon" ForeColor="#CC9900"   >



XML
<asp:Button ID="Button3"  runat="server"   Font-Size="x-small" ForeColor="Black" BackColor="White" CausesValidation="false" OnClick="cancel_click"
 style=" margin-left:3%; margin-top:0%; margin-left:3%; width:100px;cursor:pointer;  font-family:Arial;  text-align:center; height:22px; font-size:large; font-weight:600; "
 Text="CANCEL " />
</div>
Posted
Comments
OPees 12-Feb-14 6:32am    
use div tag with min height and width
S.Rajendran from Coimbatore 12-Feb-14 6:44am    
it is already in div tag. What is that min height and width.

1 solution

how to design it up to you.i am giving you basic idea. try like this (make changes in below code as per your requirements or adjustment):-
CSS
<style>
        #divmaingrid
        {
            top: 10;
            left: 10;
            height: 60%;
            width: 80%;
        }
        #divGrid
        {
            width: 100%;
            height: 80%;
            position: relative;
        }
        #divButton
        {
            width: 100%;
            height: 20%;
            position: relative;
        }
    </style>


XML
<div id="divmaingrid">
        <div id="divGrid">
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Style="left: 500px;
                margin-top: 23%; height: 105px; width: 590px; background-color: #ECE9D8;" HorizontalAlign="Center"
                BorderColor="Maroon" ForeColor="#CC9900" />
        </div>
        <div id="divButton">
            <asp:Button ID="Button3" runat="server" Font-Size="x-small" ForeColor="Black" BackColor="White"
                CausesValidation="false" OnClick="cancel_click" Style="margin-left: 3%; margin-top: 0%;
                margin-left: 3%; width: 100px; cursor: pointer; font-family: Arial; text-align: center;
                height: 22px; font-size: large; font-weight: 600;" Text="CANCEL " />
        </div>
    </div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900