0

I am using a GridView in asp.net (c#) that is bound to a EntityDataSource

I want to set one column of text to be 3 lines (height) and than fit in the width .

I have played a bit with it but with no success here is the code itself

                       <asp:TemplateField HeaderText="Description" SortExpression="Description">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                            </ItemTemplate>
                            <ControlStyle Height="20px" />
                            <ItemStyle Height="50px" Width="150px" Wrap="False" />
                        </asp:TemplateField>

btw there is no special need for me for it to be as a template field...

Anyone has an idea ? Thanks !

4

2 に答える 2

1

ItemStyle がセルに適用されます。ラベルとテキストボックスにもサイズを適用してみてください。また、Wrap プロパティを True に設定して、コンテンツが折り返され、コンテンツが 3 行以内に表示されるようにしたいと思いませんか?

于 2012-12-21T15:39:53.103 に答える
0

TextBox の代わりに、または .NET サーバー コントロールを使用できます。

<asp:TextBox id="TextArea1" TextMode="multiline" runat="server" />

または、runat = "server" で client タグを使用できます。

<textarea id="TextArea1" cols="20" rows="2" runat="server"></textarea>

このヒントを使用すると、3 行のテキスト ボックスのように使用できます。

于 2012-12-21T15:41:42.350 に答える