1

我有一个名为“ gvDUDesc”的 GridView,它具有以下列:

 <Columns>
  <asp:TemplateField HeaderText="Description" ControlStyle-Width="100%"
       ItemStyle-Width="200px">
    <ItemTemplate>
      <asp:DropDownList ID="ddlDUDescription" runat="server" AutoPostBack="true"
           OnSelectedIndexChanged="ddlDescriptionEvent" Font-Size="Smaller">
      </asp:DropDownList>
    </ItemTemplate>
   </asp:TemplateField>
 </Columns>

我想显示放置在 GridView 内的 DropDownList 的全文。我不知道如何实现这一目标?

我为普通的个人 DropDownList 尝试了以下内容。它工作正常。但是对于 GridView 里面的 DropDownList,它是行不通的。

我的解决方案中有一个单独的 style.css 文件,在该 style.css 文件中添加样式

.ctrDropDown
{
    width:154px;
    font-size:11px;
}
.ctrDropDownClick
{
    font-size: 11px;
    width:auto;
}
.plainDropDown
{
    width:154px;
    font-size:11px;
}

在 aspx 文件中,

<asp:DropDownList ID="ddlDropID" runat="server" CssClass="ctrDropDown"
                  onBlur="this.className='ctrDropDown';"
                  onMouseDown="this.className='ctrDropDownClick';" 
                  onChange="this.className='ctrDropDown';">
</asp:DropDownList>

我删除了上述语法中的 width 属性。

如何为放置在 GridView 内的 DropDownList 执行此操作?

4

1 回答 1

1

只需将下面的标记放在页面中。它需要您的下拉列表所需的宽度。

<Columns>
    <asp:TemplateField HeaderText="Description" ControlStyle-Width="100%" ItemStyle-  Width="200px">
    <ItemTemplate>
          <asp:DropDownList ID="ddlDUDescription" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlDescriptionEvent" Font-Size="Smaller">
          </asp:DropDownList>
    </ItemTemplate>
    <ItemStyle  Width="300px" />
    </asp:TemplateField>

于 2013-10-21T06:02:00.323 回答