This is a migrated thread and some comments may be shown as answers.

RadGrid EditMode Layout issue

1 Answer 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 13 Jan 2012, 05:35 PM
Hi all, I'm having an issue trying to get the right look for our grid.
The Grid autogenerates all the columns, but in the edit mode the grid expands the whole page and sometimes it creates an horizontal scroll at page level, what I want to do is that the grid respects the specified grid's width and if necessary enlarge the horizontal scroll at grid level. My aspx code is something like this:

<telerik:RadGrid id="{@id}" runat="server" AutoGenerateColumns="True" AllowMultiRowSelection="True"
    AllowMultiRowEdit="True" MasterTableView-EditMode="InPlace" Skin="Windows7"Width="50%">
    <HeaderContextMenu EnableAutoScroll="True"/>
    <MasterTableView DataSourceID="{@id}_" HorizontalAlign="NotSet">
      <Columns>
          <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
            <ItemStyle CssClass="MyImageButton" />
          </telerik:GridEditCommandColumn>
      </Columns>
      <EditFormSettings ColumnNumber="2"  InsertCaption="New">
        <FormTableItemStyle Wrap="False" />
        <FormCaptionStyle CssClass="EditFormHeader" />
        <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" />
        <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
        <FormTableAlternatingItemStyle Wrap="False" />
        <EditColumn ButtonType="ImageButton" InsertText="Insert record" UpdateText="Update record"
            UniqueName="EditCommandColumn1" CancelText="Cancel edit" />
        <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow" />
      </EditFormSettings>
    </MasterTableView>
    <ClientSettings  AllowColumnsReorder="True" ReorderColumnsOnClient="false">
        <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
        <Scrolling AllowScroll="True" UseStaticHeaders="True" />
    </ClientSettings>
</telerik:RadGrid>

And i hooked the ColumnCreated event for preventing to wrap, like this:

protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e){
    if (e.Column is GridBoundColumn)
    {
        (e.Column as GridBoundColumn).DataFormatString = "<nobr>{0}</nobr>";
    }
}

I attached screenshots that represent the actual grid behaviour in edit mode...

Thanks in advance,
Diego.

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 17 Jan 2012, 03:22 PM
Hi Diego,

When using scrolling with static headers your grid columns should declare a HeaderStyle-Width property in pixels if you want it to have consistent look.
http://www.telerik.com/help/aspnet-ajax/grid-scroll-with-static-headers.html
Currently, as you do not specify any width for the columns, they expand to accommodate the edit textboxes.

Kind regards,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Diego
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or