需要根据网格视图中的列宽换行

时间:2018-10-05 13:59:26

标签: c#

我试图动态地将文本包装在网格的列中。

我尝试将ItemStyle-Wrap =“ true”和HeaderStyle-Wrap =“ true”

这是我的aspx页面的代码段。

 <%--  <asp:BoundField DataField="ProjectManager" HeaderText="Project Manager" SortExpression="ProjectManager" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />--%>
<asp:BoundField DataField="ProjectInfo" HeaderText="Project" HtmlEncode="false" SortExpression="ProjectInfo" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false"  ItemStyle-Width="20px" HeaderStyle-Width="20px"/>
<asp:BoundField DataField="TeamMemberName" HeaderText="Employee Name" SortExpression="TeamMemberName" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true" />
<asp:BoundField DataField="TeamMemberEmployeeID" HeaderText="Employee ID" SortExpression="TeamMemberEmployeeID" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true" />

<asp:BoundField DataField="Role" HeaderText="Role" SortExpression="Role" />
<asp:BoundField DataField="JoiningDateToProject" HeaderText="JoiningDate ToProject" HtmlEncode="false" SortExpression="JoiningDateToProject" DataFormatString="{0:dd-MM-yyyy}" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true"/>
<asp:BoundField DataField="ReleaseDateFromProject" HeaderText="ReleaseDate FromProject" HtmlEncode="false" SortExpression="ReleaseDateFromProject" DataFormatString="{0:dd-MM-yyyy}" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true" />
<%--  <asp:BoundField DataField="AccountSupportFunctionID" HeaderText="Account/Support Function ID" HtmlEncode="false" SortExpression="AccountSupportFunctionID" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />
<asp:BoundField DataField="AccountName" HeaderText="Account Name" HtmlEncode="false" SortExpression="AccountName" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" />--%>

<asp:TemplateField HeaderText="Account/ Support Function ID" SortExpression="AccountSupportFunctionID" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="10px">
  <ItemTemplate>
    <asp:Label ID="lbl2" runat="server" Text=''
      <%# Eval("AccountSupportFunctionID") %>'></asp:Label>
  </ItemTemplate>
  <HeaderStyle CssClass="header" />
</asp:TemplateField>

<asp:TemplateField HeaderText="Account Name" SortExpression="AccountName" HeaderStyle-HorizontalAlign="Left">
  <ItemTemplate>
    <asp:Label ID="lbl3" runat="server" Text=''
      <%# Eval("AccountName") %>'></asp:Label>
  </ItemTemplate>
  <HeaderStyle CssClass="header" />
</asp:TemplateField>

<asp:BoundField DataField="SkillNames" HeaderText="SkillSet" HtmlEncode="false" SortExpression="SkillNames" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true"  ItemStyle-Width="20px" HeaderStyle-Width="20px" Visible="false" />
<asp:BoundField DataField="OtherSkillSet" HeaderText="Other SkillSet" HtmlEncode="false" SortExpression="OtherSkillSet" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true" Visible="false"/>
<asp:BoundField DataField="DeskTopLaptopAssetID" HeaderText="DeskTop/Laptop AssetID" HtmlEncode="false" SortExpression="DeskTopLaptopAssetID" ItemStyle-Wrap="true" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="true" />
<asp:TemplateField HeaderText="Billable" SortExpression="BillableStatus" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Wrap="false" Visible="false">
  <ItemTemplate>
    <label>
      <%# ( Convert.ToString( Eval("BillableStatus") ) == "True" )? "Yes" : "No" %></a>
    </label>
  </ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Status" HeaderText="Status" HtmlEncode="false" SortExpression="Status" />

       没有找到记录!!!   

请提供一些有用的解决方案,以使网格数据绑定并包装在列中。

在css中未生成overflow-wrap:break-word属性。

0 个答案:

没有答案