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

Using MoveUp.gif and MoveDown.gif in a GridButtonColumn

4 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bruce Parr
Top achievements
Rank 1
Bruce Parr asked on 07 Jan 2011, 09:31 PM
Hi,

I would really like to be able to use MoveUp.gif and MoveDown.gif for my row ordering functionality. I need to know if there is a specific string I should use for ImageURL (similar to Edit/Update/Delete) or if I need to copy those files from their skin folder into my app folder structure and refer to them as I would any other URL.I have looked all over the demos and documentation but haven't found anything specific.

Any and all help greatly appreciated,
B

4 Answers, 1 is accepted

Sort by
0
Mike Nogen
Top achievements
Rank 1
answered on 08 Jan 2011, 12:54 AM
Hello!

Are you using a GridButtonColumn and need to change the ImageUrl path? Here is an example how to change the image of an GridButtonColumn

<telerik:GridButtonColumn ConfirmText="Delete this Prospect?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn" ImageUrl="~/Graphics/DeleteGrey.gif">
                        <ItemStyle HorizontalAlign="Center"  />
                    </telerik:GridButtonColumn>


protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = e.Item as GridDataItem;
                  
                //Get the DeleteColumn
                TableCell cell = item["DeleteColumn"];
                ImageButton delete = cell.Controls[0] as ImageButton;
  
                if (DependingOnYourSituation)
                {
                    delete.ImageUrl = "~/Graphics/DeleteRed.gif";
                    delete.ToolTip = "Click to undo delete";
                }
                else
                {
                    delete.ImageUrl = "~/Graphics/DeleteGrey.gif";
                    delete.ToolTip = "Delete";
                }
  
            }
        }

/M





0
Bruce Parr
Top achievements
Rank 1
answered on 08 Jan 2011, 04:19 AM
Hi Mike, and thanks for the reply.

I did wind up using the code-behind method of assigning the images. 

The reason for the question, though, is that each skin folder contains MoveUp.gif and MoveDown.gif, but there is no way to assign them from the designer like the Add, Edit, Update, Delete, Refresh images etc. I was hoping there was some way to do this so I didn't have to package the images as well and remember to change them if I change the skin. It's no big deal really, but just confusing since they are mentioned in the documentation as part of the skin and are included in the folder as part of the image set, but they aren't handled the same way as the other images in the designer.

Thanks,
0
Mike Nogen
Top achievements
Rank 1
answered on 09 Jan 2011, 10:27 AM
ok, try using the ClientScript function for this.

C#
string pathToYourEmbeddedSkinImage = ClientScript.GetWebResourceUrl(Page.GetType(), "Telerik.Web.UI.Skins.Default.Grid.MoveDown.gif");

ASPX
<CommandItemTemplate>
                    <img src='<%= ClientScript.GetWebResourceUrl(yourObject.GetType(), "Telerik.Web.UI.Skins.Default.Grid.MoveDown.gif") %>'
                        alt="Move down" />
</CommandItemTemplate>


/M
0
Raj
Top achievements
Rank 1
answered on 12 Apr 2012, 07:53 PM
Hi,
I need to implement the MoveUp and MoveDown funationality in radgrid,the template column have moveup and down images buttons.
please help me out.

Thanks,
raj

Tags
Grid
Asked by
Bruce Parr
Top achievements
Rank 1
Answers by
Mike Nogen
Top achievements
Rank 1
Bruce Parr
Top achievements
Rank 1
Raj
Top achievements
Rank 1
Share this question
or