GridView修改含有DropDownList控件列的宽度
GridView进入Edit模式,编辑列动态绑定DropDown List方便客户选择,但当里面的Item过长,不免令界面不美观
正确做法:
<asp:TemplateField HeaderText="test1" SortExpression="Lv1" >
<ItemTemplate>
<%# Eval("Lv1")%>
</ItemTemplate>
<EditItemTemplate>
<asp:dropdownlist ID="test1" width="148px" runat="server" Text='<%# Bind("Lv1") %>' DataSource = "<%#getInitDT(0)%>" DataTextField ="Info" DataValueField ="Code">
</asp:dropdownlist>
</EditItemTemplate>
<ItemStyle Width="150px" />
</asp:TemplateField>
![]()
做法1:其它列宽也变化,而且DropDown List显示不正常
gv_Test.Style.Add("table-layout", "fixed")
做法2:IE9正常,IE8有问题,Header宽度没变
<asp:TemplateField HeaderText="test2" SortExpression="Lv2">
<ItemTemplate>
<%# Eval("Lv2")%>
</ItemTemplate>
<EditItemTemplate>
<asp:dropdownlist ID="test2" runat="server" style="max-width 100px !important; width: auto !important; width:100px;" Text='<%# Bind("Lv2") %>' DataSource="<%#getInitDT(1)%>" DataTextField ="Info" DataValueField ="Code">
</asp:dropdownlist>
</EditItemTemplate>
</asp:TemplateField>
无效做法3:
<EditRowStyle Width="150" />
无效做法4:
<RowStyle BackColor="#E7E7FF" ForeColor="DarkSlateBlue" HorizontalAlign ="left" Wrap ="false" Width ="150px" />
GridView修改含有DropDownList控件列的宽度的更多相关文章
- DropDownList 控件不能触发SelectedIndexChanged 事件
相信DropDownList 控件不能触发SelectedIndexChanged 事件已经不是什么新鲜事情了,原因也无外乎以下几种: 1.DropDownList 控件的属性 AutoPostBac ...
- 三级联动---DropDownList控件
AutoPostBack属性:意思是自动回传,也就是说此控件值更改后是否和服务器进行交互比如Dropdownlist控件,若设置为True,则你更换下拉列表值时会刷新页面(如果是网页的话),设置为fl ...
- DropDownList 控件
今天打算学习下dropdownlist控件的取值,当你通过数据库控件或dataset绑定值后,但又希望显示指定的值,这可不是简单的值绑定就OK,上网搜了一些资料,想彻底了解哈,后面发现其中有这么大的奥 ...
- 在FooterTemplate内显示DropDownList控件
如果想在Gridview控件FooterTemplate内显示DropDownList控件供用户添加数据时所应用.有两种方法可以实现,一种是在GridView控件的OnRowDataBound事件中写 ...
- Dev控件GridView单元格绑定控件
Dev控件GridView单元格绑定控件 //文本按钮 RepositoryItemButtonEdit btnFields = new RepositoryItemButtonEdit();//创建 ...
- DropDownList控件
1.DropDownList控件 <asp:DropDownList runat="server" ID="DropDownList1" AutoPost ...
- c#中DropDownList控件绑定枚举数据
c# asp.net 中DropDownList控件绑定枚举数据 1.枚举(enum)代码: private enum heros { 德玛 = , 皇子 = , 大头 = , 剑圣 = , } 如果 ...
- 修改Delphi工具控件的默认字体
修改Delphi工具控件的默认字体: 注册表: Delphi 6: HKEY_CURRENT_USER\Software\Borland\Delphi\6.0Delphi 7: HKEY_ ...
- DropDownList控件学习
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
随机推荐
- ~postman全局变量与环境变量介绍
postman官方文档:https://learning.getpostman.com/docs/postman/scripts/test_examples/ 一.环境变量 实例:将URL作为环境变量 ...
- PAT(B) 1087 有多少不同的值(Java)规律
题目链接:1087 有多少不同的值 (20 point(s)) 题目描述 当自然数 n 依次取 1.2.3.--.N 时,算式 ⌊n/2⌋+⌊n/3⌋+⌊n/5⌋ 有多少个不同的值?(注:⌊x⌋ 为取 ...
- Docker 学习笔记(四):问题日志
一.Docker-Compose 容器组开机重启失败 Docker-Compose 的 depends_on 参数在 docker 中没有对应. 重启电脑后,容器的重启过程只由 docker 控制,而 ...
- Django model反向关联名称的方法(转)
原文:https://www.jb51.net/article/152825.htm
- 文件流FileStream的读写
1.FileStream文件流的概念: FileStream 类对文件系统上的文件进行读取.写入.打开和关闭操作,并对其他与文件相关的操作系统句柄进行操作,如管道.标准输入和标准输出.读写操作可以指定 ...
- net技术方案
https://www.cnblogs.com/qyq0323/p/11765243.html https://yq.aliyun.com/articles/300527
- springboot下@webfilter的使用
启动类加了@ServletComponentScan,无论过滤器类加不加@Componment urlPatterns = {"/test/*"}都可以生效 单使用@Compone ...
- mac os安装mtr
MTR是Linux平台上一款非常好用的网络诊断工具,集成了traceroute.ping.nslookup的功能,用于诊断网络状态非常有用 现使用的方法是下载pkg包手动安装 mtr的pkg下载地址 ...
- Vue的学习笔记
以下文章皆为观看慕课网https://www.imooc.com/learn/796中“河畔一角”老师的讲解做的笔记,仅供参考. 一.Vue特点 Vue是MVVM的框架,也就是模型视图->视图模 ...
- SPI简述
SPI是器件的比较常用的通信协议. SPI总共有四根线: SS:片选线,每个设备都和主机MCU有一条单独片选线相连,片选线拉低意味主机输出,也就是说一个主机可以和多个从机相连,只需要有足够多的片选线. ...