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>




    --------------------------------------------------------------------------------
    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!
     
    pleaseHelp, Aug 12, 2006
    #1
    1. Advertising

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

    "pleaseHelp" <> wrote in message
    news:...
    >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>
    >
    >
    >
    >
    > --------------------------------------------------------------------------------
    > 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!
     
    InNeedOfAssistance, Aug 13, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    783
    Bruce Barker
    Oct 10, 2005
  2. kris
    Replies:
    11
    Views:
    874
  3. ssk
    Replies:
    5
    Views:
    5,513
    Jukka K. Korpela
    Oct 30, 2006
  4. rob thomson
    Replies:
    0
    Views:
    261
    rob thomson
    Sep 4, 2003
  5. Keefe Goldfisher via .NET 247

    Sizing text entry boxes on in-place editing of datagrid row with dynamically created columns

    Keefe Goldfisher via .NET 247, Mar 7, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    181
    Keefe Goldfisher via .NET 247
    Mar 7, 2005
Loading...

Share This Page