我作秀最新的消息使用网格视图...有使用数据源...显示在GridView中的数据只有一些话
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" Width="586px" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged"
onrowcommand="GridView1_RowCommand">
<Columns>
<asp:CommandField HeaderText="show" ShowSelectButton="True" />
<asp:BoundField DataField="user_id" HeaderText="user_id"
SortExpression="user_id" />
<asp:BoundField DataField="user_name" HeaderText="user_name"
SortExpression="user_name" />
<asp:BoundField DataField="sender_mail" HeaderText="sender_mail"
SortExpression="sender_mail" />
<asp:BoundField DataField="message" HeaderText="message" ReadOnly="True"
SortExpression="message" ControlStyle-Width="70px" ControlStyle-Height="25">
<ControlStyle Height="20px" Width="50px" />
<HeaderStyle Height="10px" Width="70px" />
<ItemStyle Height="20px" HorizontalAlign="Left" Width="70px" />
</asp:BoundField>
</Columns>
</asp:GridView>
有我的数据库中,如果消息太长,那么它显示一个字段... 例如:-msg是'你好,你好' 它显示完整的味精......但我只显示数据'嗨如何...' 我也尝试设置宽度和高度,但不行。
你应该在你的选择命令过程中做到这一点。有很多方法可以从桌上获得所需的sunstring。你可以在sql server中使用“Left”,“Substring”等。 – 2013-04-08 15:35:25