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

RADGrid Sorting Move Up and Down Button Hide/Show

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Platinum
Top achievements
Rank 1
Platinum asked on 18 Jun 2014, 09:12 AM
Hi,
I am using this post http://www.telerik.com/forums/radgrid-rows-sorting-move-up-and-move-down-button#e2TZo8jWa0CwWCpvuifTow

to acheive the sorting functionality.

I would like to know how to hide the Up button when it reaches the first position as it cannot be moved up further.

Similarly to hide the down button when it reaches the last position as it cannot be moved down further

Please advise.

1 Answer, 1 is accepted

Sort by
0
Accepted
Radoslav
Telerik team
answered on 23 Jun 2014, 06:45 AM
Hello Platinum,

To achieve the desired functionality you can try using following code snippet:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    (RadGrid1.MasterTableView.Items[0] as GridDataItem)["tempColumn"].FindControl("Upbtn").Visible = false;
    (RadGrid1.MasterTableView.Items[RadGrid1.MasterTableView.Items.Count - 1] as GridDataItem)["tempColumn"].FindControl("Downbtn").Visible = false;
}
Where the “tempColumn” is the unique name of the GridTemplateColumn:
<telerik:GridTemplateColumn UniqueName="tempColumn">
                    <ItemTemplate>
                        <asp:ImageButton ID="Upbtn" runat="server" ImageUrl="~/RadGrid/up.jpg" ToolTip="Up" OnClick="Upbtn_Click" />
                        <asp:ImageButton ID="Downbtn" runat="server" ImageUrl="~/RadGrid/down.jpg" ToolTip="Down" OnClick="Downbtn_Click" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>

Please give it try and let me know if it helps you. Looking forward for your reply.

Regards,
Radoslav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Platinum
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or