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

[Solved] change image in cell when cell is clicked

1 Answer 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chuck Thompson
Top achievements
Rank 1
Chuck Thompson asked on 26 Oct 2009, 04:06 PM
My first column in the grid is an action column with 3 posibilities.
Each posibility is a different image.
When a user clicks on the cell I need to change the value of the image in the cell.
I tried this but it did not work:
void dgMainT_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)  
        {  
            string colText = string.Empty;  
            if (dgMainT.CurrentCell.Column != null)  
            {  
                colText = dgMainT.CurrentCell.Column.Header.ToString();  
            }  
            if (colText == "Action")  
            {  
                //change the icon  
                GridViewCell cell = dgMainT.CurrentCell;  
                cell.Value = "Images/ArrowDown.png";  
 
            }  
        } 

When I set the value of the cell it has no effect.

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 29 Oct 2009, 12:37 PM
Hi Chuck ,
The attached sample project illustrates a way to achieve your goal . When you run the project a column with images inside will be shown. When you click on the image , the image will be changed.

Regards,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Chuck Thompson
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or