|
I have a GridView with a field that contains long strings of text. I would like to make the grid directly editable, rather than using a details view. I finally figured out how to make the TextBox in the Edit view bigger, but I cannot find option to to make the text in it wrap or for adding scroll bars. Is there a way to accomplish what I'm trying to do, either with control properties or through manual coding? Thanks in advance for your advice. Steve |
| srgibson Friday, December 02, 2005 3:21 PM |
There is a property for the textbox called "Textmode". change the property to Multiline, it will add a verticle scrollbar and wrap text in the horizontal. It's very unfortunate that nobody has answered you sooner. Aren't these forums monitored by microsoft? |
| Jarvism Wednesday, June 14, 2006 11:16 PM |
I have same problem. I want to change multiline property of one column in Edit mode. Code is here :
<asp:GridView ID="GridView1" Runat="server" DataSourceID="AccessDataSource1" DataKeyNames="ID" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True"></asp:CommandField>
<asp:BoundField ReadOnly="True" HeaderText="ID" InsertVisible="False" DataField="ID"
SortExpression ="ID"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlk" DataField="Baslik" SortExpression="Baslik"></asp:BoundField>
<asp:BoundField HeaderText="Metin" DataField="Metin" SortExpression="Metin"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlangç Tarihi" DataField="BaslangicTarihi" SortExpression="BaslangicTarihi"></asp:BoundField>
<asp:BoundField HeaderText="BitiŸ Tarihi" DataField="BitisTarihi" SortExpression="BitisTarihi"></asp:BoundField>
<asp:BoundField HeaderText="Duyuruyu Ekleyen" DataField="Ekleyen" SortExpression="Ekleyen"></asp:BoundField>
<asp:BoundField HeaderText="Aktif" DataField="Aktif" SortExpression="Aktif"></asp:BoundField>
</Columns>
</ asp:GridView> |
| kemal Saturday, September 16, 2006 7:39 PM |
I have same problem. I want to change multiline property of one column in Edit mode. Code is here :
<asp:GridView ID="GridView1" Runat="server" DataSourceID="AccessDataSource1" DataKeyNames="ID" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True"></asp:CommandField>
<asp:BoundField ReadOnly="True" HeaderText="ID" InsertVisible="False" DataField="ID"
SortExpression ="ID"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlk" DataField="Baslik" SortExpression="Baslik"></asp:BoundField>
<asp:BoundField HeaderText="Metin" DataField="Metin" SortExpression="Metin"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlangç Tarihi" DataField="BaslangicTarihi" SortExpression="BaslangicTarihi"></asp:BoundField>
<asp:BoundField HeaderText="BitiŸ Tarihi" DataField="BitisTarihi" SortExpression="BitisTarihi"></asp:BoundField>
<asp:BoundField HeaderText="Duyuruyu Ekleyen" DataField="Ekleyen" SortExpression="Ekleyen"></asp:BoundField>
<asp:BoundField HeaderText="Aktif" DataField="Aktif" SortExpression="Aktif"></asp:BoundField>
</Columns>
</ asp:GridView> |
| kemal Saturday, September 16, 2006 7:41 PM |
I have same problem. I want to change multiline property of one column in Edit mode. Code is here :
<asp:GridView ID="GridView1" Runat="server" DataSourceID="AccessDataSource1" DataKeyNames="ID" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True"></asp:CommandField>
<asp:BoundField ReadOnly="True" HeaderText="ID" InsertVisible="False" DataField="ID"
SortExpression ="ID"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlk" DataField="Baslik" SortExpression="Baslik"></asp:BoundField>
<asp:BoundField HeaderText="Metin" DataField="Metin" SortExpression="Metin"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlangç Tarihi" DataField="BaslangicTarihi" SortExpression="BaslangicTarihi"></asp:BoundField>
<asp:BoundField HeaderText="BitiŸ Tarihi" DataField="BitisTarihi" SortExpression="BitisTarihi"></asp:BoundField>
<asp:BoundField HeaderText="Duyuruyu Ekleyen" DataField="Ekleyen" SortExpression="Ekleyen"></asp:BoundField>
<asp:BoundField HeaderText="Aktif" DataField="Aktif" SortExpression="Aktif"></asp:BoundField>
</Columns>
</ asp:GridView> |
| kemal Saturday, September 16, 2006 7:42 PM |
I have same problem. I want to change multiline property of one column in Edit mode. Code is here :
<asp:GridView ID="GridView1" Runat="server" DataSourceID="AccessDataSource1" DataKeyNames="ID" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True"></asp:CommandField>
<asp:BoundField ReadOnly="True" HeaderText="ID" InsertVisible="False" DataField="ID"
SortExpression ="ID"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlk" DataField="Baslik" SortExpression="Baslik"></asp:BoundField>
<asp:BoundField HeaderText="Metin" DataField="Metin" SortExpression="Metin"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlangç Tarihi" DataField="BaslangicTarihi" SortExpression="BaslangicTarihi"></asp:BoundField>
<asp:BoundField HeaderText="BitiŸ Tarihi" DataField="BitisTarihi" SortExpression="BitisTarihi"></asp:BoundField>
<asp:BoundField HeaderText="Duyuruyu Ekleyen" DataField="Ekleyen" SortExpression="Ekleyen"></asp:BoundField>
<asp:BoundField HeaderText="Aktif" DataField="Aktif" SortExpression="Aktif"></asp:BoundField>
</Columns>
</ asp:GridView> |
| kemal Saturday, September 16, 2006 7:50 PM |
I have same problem. I want to change multiline property of one column in Edit mode. Code is here :
<asp:GridView ID="GridView1" Runat="server" DataSourceID="AccessDataSource1" DataKeyNames="ID" AutoGenerateColumns="False"
AllowSorting="True" AllowPaging="True">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" ShowInsertButton="True"></asp:CommandField>
<asp:BoundField ReadOnly="True" HeaderText="ID" InsertVisible="False" DataField="ID"
SortExpression ="ID"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlk" DataField="Baslik" SortExpression="Baslik"></asp:BoundField>
<asp:BoundField HeaderText="Metin" DataField="Metin" SortExpression="Metin"></asp:BoundField>
<asp:BoundField HeaderText="BaŸlangç Tarihi" DataField="BaslangicTarihi" SortExpression="BaslangicTarihi"></asp:BoundField>
<asp:BoundField HeaderText="BitiŸ Tarihi" DataField="BitisTarihi" SortExpression="BitisTarihi"></asp:BoundField>
<asp:BoundField HeaderText="Duyuruyu Ekleyen" DataField="Ekleyen" SortExpression="Ekleyen"></asp:BoundField>
<asp:BoundField HeaderText="Aktif" DataField="Aktif" SortExpression="Aktif"></asp:BoundField>
</Columns>
</ asp:GridView> |
| kemal Saturday, September 16, 2006 7:50 PM |
This is not available in a bound field You will have to set it up as a custom template field with an itemtemplate and edittemplate that contains a textbox in order to set this up. <asp:TemplateField HeaderText="Birth Date"> <ItemTemplate> <asp:Label ID="BirthDateLabel" Runat="Server" Text='<%# Eval("BirthDate", "{0 }") %>' /> </ItemTemplate> <InsertItemTemplate> <asp:Calendar ID="InsertBirthDateCalendar" Runat="Server" SelectedDate='<%# Bind("BirthDate") %>' /> </InsertItemTemplate> <EditItemTemplate> <asp:Calendar ID="EditBirthDateCalendar" Runat="Server" VisibleDate='<%# Eval("BirthDate") %>' SelectedDate='<%# Bind("BirthDate") %>' /> </EditItemTemplate> </asp:TemplateField>
If only editing is allowed you do not need the InsertItemTemplate. |
| crjangel Wednesday, June 13, 2007 3:57 PM |
Here is a better example of the code. It is a textbox:
<asp:TemplateField HeaderText="Research/Analysis Issues" HeaderStyle-CssClass=Rtitle > <ItemTemplate> <asp:Label ID="Label1" runat="server" CssClass="bodystyle" Text='<%# Bind("research") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox TextMode=MultiLine Columns=50 Rows=6 ID="EditResearch" runat="server" Wrap="true" Text='<%# Bind("research") %>'> </asp:TextBox> </EditItemTemplate> <ControlStyle CssClass="bodystyle" /> <HeaderStyle Wrap="false" /> </asp:TemplateField>
Experiment with the column and row number that is best for your data.
|
| crjangel Wednesday, June 13, 2007 4:10 PM |
I struggled with trying to prevent text from wrapping in my GridView and have come to the conclusion that NONE of the property controls seem to be able to provide "Wrap=False".
I solved the presentation issue by setting the column to a template field and the replacing the Label control in the Item Template with a TextBox control. The text box has a Wrap property which obeys "False". I then set the text box background to transparent and its borders to 0px. It sits very happily in my GridView and truncates the text, as desired. |
| CJDuva Monday, September 10, 2007 9:07 PM |
|
| MoMad Tuesday, November 13, 2007 11:26 PM |