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

[Solved] AutomaticInsert Style Problem

1 Answer 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Babak
Top achievements
Rank 1
Babak asked on 08 Jul 2013, 08:20 AM
hi , I have a radgrid in my page , when I want to use Automatic insert the insert button goes the outside of the grid zone ,
how can I do ?

<telerik:RadGrid ID="FieldGrid" runat="server" Width="100%" dir="rtl" OnNeedDataSource="FieldGrid_NeedDataSource" Skin="Hay" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" OnInsertCommand="FieldGrid_InsertCommand" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" AutoGenerateHierarchy="True">
                       <ExportSettings>
                           <Pdf>
                               <PageHeader>
                                   <LeftCell Text="" />
                                   <MiddleCell Text="" />
                                   <RightCell Text="" />
                               </PageHeader>
                               <PageFooter>
                                   <LeftCell Text="" />
                                   <MiddleCell Text="" />
                                   <RightCell Text="" />
                               </PageFooter>
                           </Pdf>
                       </ExportSettings>
                       <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                           <Selecting AllowRowSelect="True" />
                           <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                       </ClientSettings>
                       <MasterTableView CommandItemDisplay="TopAndBottom" Dir="rtl" DataKeyNames="FiledId" HierarchyLoadMode="Client" EditMode="InPlace" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" AllowPaging="True">
                           <CommandItemSettings ExportToPdfText="Export to PDF" />
                           <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                           </RowIndicatorColumn>
                           <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True" Created="True">
                           </ExpandCollapseColumn>
                           <EditFormSettings>
                               <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                               </EditColumn>
                           </EditFormSettings>
                           <PagerStyle PageSizeControlType="RadComboBox" />
                           <Columns>
                               <telerik:GridBoundColumn DataField="FiledNameEN" FilterControlAltText="Filter FiledNameEN column" HeaderText="FiledNameEN" SortExpression="FiledNameEN" UniqueName="FiledNameEN">
                                   <ItemStyle Width="100px" Wrap="False" />
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="100px" Wrap="False" />
                               </telerik:GridBoundColumn>
                             <telerik:GridBoundColumn DataField="FiledNameFA" FilterControlAltText="Filter FiledNameFA column" HeaderText="FiledNameFA" SortExpression="FiledNameFA" UniqueName="FiledNameFA">
                                   <ItemStyle Width="100px" />
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="100px" />
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="FiledType" FilterControlAltText="Filter FiledType column" HeaderText="FiledType" SortExpression="FiledType" UniqueName="FiledType">
                                   <ItemStyle Width="100px" />
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="100px" />
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="FiledDefaultValue" FilterControlAltText="Filter FiledDefaultValue column" HeaderText="FiledDefaultValue" SortExpression="FiledDefaultValue" UniqueName="FiledDefaultValue">
                                   <ItemStyle Width="200px" />
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="200px" />
                               </telerik:GridBoundColumn>
                               <telerik:GridBoundColumn DataField="FiledDescription" FilterControlAltText="Filter FiledDescription column" HeaderText="FiledDescription" SortExpression="FiledDescription" UniqueName="FiledDescription">
                                   <ItemStyle Width="200px" />
                                   <ColumnValidationSettings>
                                       <ModelErrorMessage Text="" />
                                   </ColumnValidationSettings>
                                   <HeaderStyle Width="200px" />
                               </telerik:GridBoundColumn>
                               <telerik:GridTemplateColumn DataField="HelpName" FilterControlAltText="Filter HelpName column" HeaderText="HelpName" SortExpression="HelpName" UniqueName="HelpName">
                                   <InsertItemTemplate>
                                       <telerik:RadDropDownTree ID="HelpTree" runat="server" DataFieldID="HelpId" DataFieldParentID="HelpParentId" DataSourceID="HelpSelectODS" DataTextField="HelpName" DataValueField="HelpId" dir="rtl">
                                       </telerik:RadDropDownTree>
                                   </InsertItemTemplate>
                                   <ItemTemplate>
                                       <asp:Label ID="HelpIdLabel" runat="server" Text='<%# Eval("HelpName") %>'></asp:Label>
                                   </ItemTemplate>
                                   <ItemStyle Width="200px" />
                                   <HeaderStyle Width="200px" />
                               </telerik:GridTemplateColumn>
                           </Columns>
                       </MasterTableView>
                       <PagerStyle PageSizeControlType="RadComboBox" />
                       <FilterMenu EnableImageSprites="False">
                       </FilterMenu>
                   </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 11 Jul 2013, 08:47 AM
Hello Babak,

Note that the auto generated edit/delete column has a default width with is 30px. A possible solution is to increase the width of the column. Check out the following code snippet.
protected void FieldGrid_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column.UniqueName == "AutoGeneratedEditColumn")
        {
            (e.Column as GridEditCommandColumn).HeaderStyle.Width = Unit.Pixel(600);
        }
    }


Regards,
Kostadin
Telerik
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 the blog feed now.
Tags
Grid
Asked by
Babak
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or