我有一张桌子,桌子上有几个按钮和一个 Gridview。我正在尝试将文本包装在其中一个boundfield
Gridview 中。
我试图RowStyle
Wrap="true"
在 Gridview 属性中设置ItemStyle
Wrap="true"
并Width
在 boundfield 属性中设置 和 ,但是没有用。
以下是我的aspx
.
<table align="center" border="0" cellpadding="0" cellspacing="2" >
<tr>
<td></td>
<td align="right">
<asp:Button ID="btnAdd" runat="server" Text="Add Subscription"
onclick="btnAdd_Click" CausesValidation="False" />
</td>
</tr>
<tr>
<td colspan="2">
<p align="center" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px" >
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</p>
</td>
</tr>
<tr>
<td align="left" colspan="2">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="SubscriptionID,UserID"
DataSourceID="SqlDSEmailSubscriptions" Width="90%" CellPadding="4"
EnableViewState="False" AllowPaging="True">
<Columns>
<asp:TemplateField HeaderText="SubscriptionName" SortExpression="SubscriptionName">
<ItemTemplate>
<asp:LinkButton ID="lbtnSubscription" runat="server" CausesValidation="false"
Text='<%# Eval("SubscriptionName")%>' OnClick="lbtnSubscription_Click">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="SubscriptionName" HeaderText="SubscriptionName"
SortExpression="SubscriptionName" Visible="false" />
<asp:BoundField DataField="SubscriptionID" HeaderText="SubscriptionID"
ReadOnly="True" SortExpression="SubscriptionID" />
<asp:BoundField DataField="ProductList" HeaderText="ProductList"
SortExpression="ProductList" />
<asp:BoundField DataField="DivisionList" HeaderText="DivisionList"
SortExpression="DivisionList" />
<asp:BoundField DataField="DisciplineList" HeaderText="DisciplineList"
SortExpression="DisciplineList" />
<asp:BoundField DataField="UserID" HeaderText="UserID" ReadOnly="True"
SortExpression="UserID" Visible="false" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDSEmailSubscriptions" runat="server"
ConnectionString="<%$ ConnectionStrings:SPRConnectionString %>"
SelectCommand="SELECT [SubscriptionID], [SubscriptionName], [ProductList], [DivisionList], [DisciplineList], [UserID] FROM [sprEmailSubscriptions] WHERE ([UserID] = @UserID) ORDER BY [SubscriptionName]">
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="userID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>