HighTechTalks DotNet Forums  

width of columns when editing text in the datagrid

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss width of columns when editing text in the datagrid in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
pleaseHelp
 
Posts: n/a

Default width of columns when editing text in the datagrid - 08-12-2006 , 01:43 PM






I have a datagrid that contains multiple text columns which I need to have
wrapped because of their size. Below is the code that I have at the moment.
When the grid is viewed in either Internet Explorer or Firefox everything
looks perfect - good column widths and the text all wraps correctly. My
problem is that the display is totally unreadable once one enters edit mode.
In Internet Explorer, the column is really wide - actually as wide as the
text is and the text does not wrap - it's in one continuous line that
scrolls off the screen. When in edit mode using Firefox, the columns are of
the correct width but the text is still in one continuous line - it doesn't
wrap as it should.

I could really use your help to figure out why I can't get the text to wrap
in edit mode and why in Internet Explorer I can't control the width of the
column in edit mode.

Thanks for your help and suggestions.


<aspataGrid id="SectionDetailDataGrid"
OnSelectedIndexChanged="getSectionDetailID"
runat="server" Width="100%" EditItemStyle-Font-Name="Verdana"
SelectedItemStyle-Wrap = "True" PagerStyle-Wrap="True"
AutoGenerateColumns="False" EditItemStyle-Font-Size="8"
EditItemStyle-Wrap="True"
DataKeyField="section_detail_id" OnEditCommand="OnEdit"
OnCancelCommand="OnCancel"
OnUpdateCommand="OnUpdate" GridLines="Both" BorderStyle="Groove">

<Columns>
<asp:EditCommandColumn EditText="Edit" CancelText="Cancel"
UpdateText="Update" ItemStyle-Font-Name="Verdana"
ItemStyle-Font-Size="7" />

<asp:TemplateColumn>
<HeaderTemplate>
<asp:Label Font-Name="Verdana" Font-Size="8" Font-Bold="true"
ID="Label_title_directions" Runat="server" Width="15%" >
Directions
</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.directions")
%>'
ID="Label_directions" Font-Name="Verdana" Font-Size="7"
Runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" Width="100%"
Text='<%# DataBinder.Eval(Container, "DataItem.directions")
%>'
ID="Textbox_directions" BackColor="#8fcfcf"
Font-Name="Verdana"
Font-Size="7" Runat="server" Wrap="True" Height="300"
Rows="20" />
</EditItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn>
<HeaderTemplate>
<asp:Label Font-Name="Verdana" Font-Size="8" Font-Bold="true"
ID="Label_title_comments" Runat="server" Width="15%" >
Comments
</asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.comments")
%>'
ID="Label_comments" Font-Name="Verdana" Font-Size="7"
Runat="server" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" Width="100%"
Text='<%# DataBinder.Eval(Container, "DataItem.comments")
%>'
ID="Textbox_comments" BackColor="#8fcfcf"
Font-Name="Verdana"
Font-Size="7" Runat="server" Wrap="True" Height="300" />
</EditItemTemplate>
</asp:TemplateColumn>

</Columns>
</aspataGrid>




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 133 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!



Reply With Quote
  #2  
Old   
InNeedOfAssistance
 
Posts: n/a

Default Re: width of columns when editing text in the datagrid - 08-12-2006 , 07:38 PM






My problem was that I wasn't using Textmode = multiline

"pleaseHelp" <woody (AT) rohland (DOT) org> wrote

Quote:
I have a datagrid that contains multiple text columns which I need to have
wrapped because of their size. Below is the code that I have at the moment.
When the grid is viewed in either Internet Explorer or Firefox everything
looks perfect - good column widths and the text all wraps correctly. My
problem is that the display is totally unreadable once one enters edit
mode. In Internet Explorer, the column is really wide - actually as wide as
the text is and the text does not wrap - it's in one continuous line that
scrolls off the screen. When in edit mode using Firefox, the columns are of
the correct width but the text is still in one continuous line - it doesn't
wrap as it should.

I could really use your help to figure out why I can't get the text to
wrap in edit mode and why in Internet Explorer I can't control the width
of the column in edit mode.

Thanks for your help and suggestions.


aspataGrid id="SectionDetailDataGrid"
OnSelectedIndexChanged="getSectionDetailID"
runat="server" Width="100%" EditItemStyle-Font-Name="Verdana"
SelectedItemStyle-Wrap = "True" PagerStyle-Wrap="True"
AutoGenerateColumns="False" EditItemStyle-Font-Size="8"
EditItemStyle-Wrap="True"
DataKeyField="section_detail_id" OnEditCommand="OnEdit"
OnCancelCommand="OnCancel"
OnUpdateCommand="OnUpdate" GridLines="Both" BorderStyle="Groove"

Columns
asp:EditCommandColumn EditText="Edit" CancelText="Cancel"
UpdateText="Update" ItemStyle-Font-Name="Verdana"
ItemStyle-Font-Size="7" /

asp:TemplateColumn
HeaderTemplate
asp:Label Font-Name="Verdana" Font-Size="8" Font-Bold="true"
ID="Label_title_directions" Runat="server" Width="15%"
Directions
/asp:Label
/HeaderTemplate
ItemTemplate
asp:Label runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.directions") %>'
ID="Label_directions" Font-Name="Verdana" Font-Size="7"
Runat="server" /
/ItemTemplate
EditItemTemplate
asp:TextBox runat="server" Width="100%"
Text='<%# DataBinder.Eval(Container,
"DataItem.directions") %>'
ID="Textbox_directions" BackColor="#8fcfcf"
Font-Name="Verdana"
Font-Size="7" Runat="server" Wrap="True" Height="300"
Rows="20" /
/EditItemTemplate
/asp:TemplateColumn

asp:TemplateColumn
HeaderTemplate
asp:Label Font-Name="Verdana" Font-Size="8" Font-Bold="true"
ID="Label_title_comments" Runat="server" Width="15%"
Comments
/asp:Label
/HeaderTemplate
ItemTemplate
asp:Label runat="server"
Text='<%# DataBinder.Eval(Container, "DataItem.comments")
%>'
ID="Label_comments" Font-Name="Verdana" Font-Size="7"
Runat="server" /
/ItemTemplate
EditItemTemplate
asp:TextBox runat="server" Width="100%"
Text='<%# DataBinder.Eval(Container, "DataItem.comments")
%>'
ID="Textbox_comments" BackColor="#8fcfcf"
Font-Name="Verdana"
Font-Size="7" Runat="server" Wrap="True" Height="300" /
/EditItemTemplate
/asp:TemplateColumn

/Columns
/aspataGrid




--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 133 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 10610 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.