如何控制Gridview的大小,当它在编辑模式而不是? [英] How to taking control of size of Gridview when its on edit mode and its not?

查看:1104
本文介绍了如何控制Gridview的大小,当它在编辑模式而不是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会有我的Gridview用户控件在灰色框架(它的div标签)无论Gridview是否在编辑模式,我没有使用Gridview的宽度和样式,但它没有工作。
我如何做到这一点?

I would have my Gridview User Control In gray frame(its div tag) whether Gridview is in editmode or not, I did use Gridview's Width and Styles but it didn't work. How do I do this?

.GridViewStyle
{
 /*It didn't work*/
 width:50%;
}

Gridview处于编辑模式时

Gridview when its in edit mode

Gridview不处于编辑模式

推荐答案

问题当然是<$ c $处于编辑模式时, 文本框

添加< EditRowStyle& code>元素添加到您的gridview以赋予编辑行一个CSS类

Add the <EditRowStyle> element to your gridview to give the edit row a CSS class

<asp:GridView ID="GridView1" runat="server">
    ...
    <EditRowStyle CssClass="GridViewEditRow" /> <%-- add this --%>
</asp:GridView>

现在,您可以使用CSS控制文本框的大小

Now you can control the size of the textboxes with CSS

.GridViewEditRow input[type=text] {width:50px;} /* size textboxes */
.GridViewEditRow select {width:50px;} /* size drop down lists */

这篇关于如何控制Gridview的大小,当它在编辑模式而不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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