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

Grid Edit and Delete column shifting to right with AutoGenerated columns

1 Answer 198 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 24 Feb 2011, 07:51 AM
Hi,

I have a Grid with the AutoGenerated Columns set to true and The Edit,Delete Column defined in the MasterTableView in design time. Currently the Edit and Delete columns appear to be on the left hand side and the AutoGenerated columns next to Edit and delete columns. Now we need to shift the Edit and delete columns to the right without affecting the sequence of the columns generated. We have tried swapping the columns technique but it seems to effect the sequence of autogenerated columns.

Please can you let us know the direct way to achieve this a bit urgently.

Below is the part of code for your reference which creates the Edit Delete column to the left:

<telerik

 

 

:RadGrid AutoGenerateColumns="true" ID="grid" runat="server" AllowSorting="True"

 

 

 

 

 

 

AllowPaging="true" ShowFooter="false">

 

 

 

<GroupHeaderItemStyle></GroupHeaderItemStyle>

 

 

 

<FilterMenu>

 

 

 

</FilterMenu>

 

 

 

<MasterTableView CommandItemDisplay="Top">

 

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

 

<RowIndicatorColumn Visible="False" UniqueName="RowIndicator">

 

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

 

<ItemStyle></ItemStyle>

 

 

 

</RowIndicatorColumn>

 

 

 

<EditFormSettings>

 

 

 

<EditColumn Visible="false" UniqueName="EditCommandColumn">

 

 

 

</EditColumn>

 

 

 

</EditFormSettings>

 

 

 

<ExpandCollapseColumn Visible="False" UniqueName="ExpandColumn" ButtonType="ImageButton">

 

 

 

<HeaderStyle Width="19px"></HeaderStyle>

 

 

 

</ExpandCollapseColumn>

 

 

 

<CommandItemTemplate>

 

 

 

 

</CommandItemTemplate>

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn HeaderText="" UniqueName="Edit"

 

 

 

AllowFiltering="false">

 

 

 

<HeaderStyle Width="1%" />

 

 

 

<itemtemplate>

 

 

 

 

<a href="#" id="A3" title="Edit" onclick="OpenWindow(<%# DataBinder.Eval(Container.DataItem,"id") %>)">

 

<%

 

--<img onclick="javascript:handler('','ctl00_MainContentHolder_RadPanelBar3_i0_i0_grid','<%# Container.ItemIndex %>')" style="border: 0" src="images/Edit.png" alt="Edit" />--%>

 

 

 

 

<eui:eLabel ID="lblEdit" runat="server" Text="Edit" CssClass="label" ForeColor="Blue"></eui:eLabel>

 

 

 

</a>

 

 

 

</itemtemplate>

 

 

 

<itemstyle cssclass="MyImageButton" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

<telerik:GridTemplateColumn HeaderText="" UniqueName="Delete"

 

 

 

AllowFiltering="false">

 

 

 

<HeaderStyle Width="1%" />

 

 

 

<itemtemplate>

 

 

 

<asp:TextBox id="txt1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "id")%>' style="display:none" ></asp:TextBox>

 

 

 

<a href="#" id='<%# DataBinder.Eval(Container.DataItem, "id")%>' title="Delete" onclick='Textt(this)'>

 

<%

 

--<img onclick="javascript:handler('','ctl00_MainContentHolder_RadPanelBar3_i0_i0_grid','<%# Container.ItemIndex %>')" style="border: 0" src="images/Delete.png" alt="Delete" />--%>

 

 

 

 

<eui:eLabel ID="lblDelete" runat="server" Text="Delete" CssClass="label" ForeColor="Blue"></eui:eLabel>

 

 

 

</a>

 

 

 

</itemtemplate>

 

 

 

<itemstyle cssclass="MyImageButton" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

</Columns>

 

 

 

 

<ItemStyle></ItemStyle>

 

 

 

<AlternatingItemStyle/>

 

 

 

<CommandItemStyle />

 

 

 

</MasterTableView>

 

 

 

<HeaderStyle HorizontalAlign="Center"></HeaderStyle>

 

 

 

<ClientSettings EnableRowHoverStyle="false">

 

 

 

<ClientEvents />

 

 

 

<Selecting AllowRowSelect="false"></Selecting>

 

 

 

<Resizing AllowRowResize="false" EnableRealTimeResize="false" ResizeGridOnColumnResize="false"

 

 

 

AllowColumnResize="false"></Resizing>

 

 

 

</ClientSettings>

 

 

 

</telerik:RadGrid>

 





Thanks in Advance.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Feb 2011, 09:18 AM
Hello David,

The OrderIndex property lets you change the position of columns to move them to a specific location. Here is a documentation that describes more on this.
Reordering columns

Thanks,
Shinu.
Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or