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

Editable Image Column

3 Answers 83 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.
Jason
Top achievements
Rank 1
Jason asked on 08 Jun 2011, 09:37 PM
Hello Everyone

I have a RadGridView using a RadDomainDataSource as an item source (which connects to a Microsoft SQL Server 2008 Server). One of the columns in this RadGridView is a GridViewImageColumn that displays an image that is stored directly in the SQL Server as an image data type.

I can display, add, edit and delete the string and numeric data in the RadGridView and these changes are reflected on the SQL Server but I cannot find any way to add or edit an image in the GridViewImageColumn and have this pushed up to the server through the RadDomainDataSource.

I have extensively searched the forum and looked at a number of Blog entries but nothing I have found yet has given an example of how to make the GridViewImageColumn editable.

Can someone please show a brief example of how to add/edit an image in the GridViewImageColumn so this can be sent to the server.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 09 Jun 2011, 06:45 AM
Hello Jason,

Could you please provide more information about your scenario. Who you you go about editing the image information? If what you have mentioned is correct then you will need some kind of image editor to edit the image.


Greetings,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jason
Top achievements
Rank 1
answered on 09 Jun 2011, 07:53 AM
Hi Milan

Thanks for the reply. Sorry I might have explained the situation badly. When I say edit the image I don't mean edit in the sense of image editing like photoshop. What I mean is with the RadGridView you can edit cells in a row (i.e. change the values) and have these changes pushed up to the database and I want this to apply to the GridViewImageColumn as well.

For example.. if one of the columns is "Customer Name" (a Text Value) you can edit this cell and change the value from "Bob" to "James" this value will be changed at the database (This all works and is great)... but... how do I go about changing the data in a GridViewImageColumn. For example if I want to change "Bob's" picture to "James's" picture, how can I do this.

As an example I would like the user to be able to maybe Double Click the image in the GridViewImageColumn cell and a Browse for file dialog box would pop up and the user could select another image to go in the cell (that is replace one image for another). When row editing has finished this data would be sent up to the database like the Numeric and Text fields and the image in the database would be replaced.

The image data is stored in the database as an Image datatype (SQL Server 2008R2) and not as a URL.

So what I need is an example of how the you would replace the Image "Value" in the GridViewImageColumn for another image.

Does this make more sense? I hope I explained it better this time.. let me know if I need to explain further and I will try diagram what I am trying to do.

Thanks again..
0
Pavel Pavlov
Telerik team
answered on 09 Jun 2011, 10:07 AM
Hi Jason,

The approach would be  :

1. Prepare a user control which provides the UI and a logic  to select a new image and encode it the way it should be persisted in the DB . Expose the image as a dependency property on this control.

2. Place this user control in the CellEdit template of the column.

3. Bind the exposed property of the user control  , to the relevant property in your business objects.

Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Milan
Telerik team
Jason
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or