width of columns when editing text in the datagrid

Discussion in 'ASP .Net Datagrid Control' started by pleaseHelp, Aug 12, 2006.

  1. pleaseHelp

    pleaseHelp Guest

    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.


    <asp:DataGrid 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>
    </asp:DataGrid>
     
    pleaseHelp, Aug 12, 2006
    #1
    1. Advertisements

  2. My problem was that I wasn't using Textmode = multiline
     
    InNeedOfAssistance, Aug 13, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.