如何在Gridview外部维护按钮控件的位置 [英] How to maintain the location of a button control outside Gridview

查看:64
本文介绍了如何在Gridview外部维护按钮控件的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Gridview1中有行时,button3位置根据GV的大小工作。

当GV中没有行时,BTN3位置会被更改并显示在其他地方。

我把GV和BTN放在同一个

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

中。即使GV是空的,如何保持BTN3的位置。



以下是代码:



. How to maintain the location of BTN3 even if the GV is empty.

The following is the code:

<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"   >










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

推荐答案

如何设计你。我给你基本的想法。尝试这样(在下面做出改动)代码根据您的要求或调整): -

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):-
<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>







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


这篇关于如何在Gridview外部维护按钮控件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆