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

[Solved] can't add image / tabIndex to GridBinaryImageColumn

3 Answers 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris Yoker
Top achievements
Rank 1
Chris Yoker asked on 19 Nov 2009, 02:21 PM

vs2008

q2 2009

Hiya,

I need to add the above to the GridBinaryImageColumn in the grid, but every time I add it I get an error.
I only want the image to appear when in editMode.

<telerik:GridBinaryImageColumn DataAlternateTextField="Description" DataAlternateTextFormatString="No photo added yet" 
                        DataField="Data" HeaderText="Photo" ImageAlign="NotSet" ImageHeight="80px" ImageWidth="80px" 
                        ResizeMode="Fit" UniqueName="Upload" > 
                        <HeaderStyle Width="10%" />                         
                    </telerik:GridBinaryImageColumn> 

Any ideas? I'm struggling with this one.

Thanks,

yogi


3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 24 Nov 2009, 04:58 PM
Hi Chris,

This is not supported with the built-in GridBinaryImageColumn. To display the image when items are switched in edit mode, you may consider using GridTemplateColumn with RadBinaryImage inside its item/edit templates and RadUpload in its edit template.

See how this is done with our RadListView control on the following online demo:
http://demos.telerik.com/aspnet-ajax/listview/examples/firstlook/defaultcs.aspx

and port the solution for your scenario.

Kind regards,
Sebastian
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.
0
Chris Yoker
Top achievements
Rank 1
answered on 25 Nov 2009, 01:20 PM
hiya,

You recommended the following:

((To display the image when items are switched in edit mode, you may consider using GridTemplateColumn with RadBinaryImage inside its item/edit templates and RadUpload in its edit template.))

This is what I have done. The image column displays fine when not in editMode, However, when I try to edit, it doesn't work.

This is what I  originally had:

<telerik:GridBinaryImageColumn DataAlternateTextField="Description" DataAlternateTextFormatString="No photo added yet" 
                        DataField="Data" HeaderText="Photo" ImageAlign="NotSet" ImageHeight="80px" ImageWidth="80px" 
                        ResizeMode="Fit" UniqueName="Upload"
                        <HeaderStyle Width="10%" /> 
                    </telerik:GridBinaryImageColumn> 
 

Based on your advice, my column is now as follows:

<telerik:GridTemplateColumn DataField="Data" HeaderText="Photo" SortExpression="Data" 
                        UniqueName="Upload"
                        <ItemTemplate> 
                            <telerik:RadBinaryImage EnableViewState="false" ID="RadBinaryImage1" runat="server" 
                                AlternateText="Job Photo" ToolTip="Job Photo" Width="90px" Height="110px" ResizeMode="Fit" 
                                DataValue='<%# Eval("Data") %>' /> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <telerik:RadUpload  runat="server" Visible="true" ID="x1" FocusOnLoad="true" AllowedFileExtensions=".jpg,.jpeg,.gif,.png"
                            </telerik:RadUpload> 
                        </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 


I believe my issue is that:

1) the GridBinaryImageColumn has a “DataField” property,

2) whereas a RadUpload does not, even whenincluded in an editTemplate.

 

..So, how do I tell my sqlDataSource where to get the “Data” parameter from?

 

Please help.

 

Thanks.


0
Sebastian
Telerik team
answered on 25 Nov 2009, 02:58 PM

Hello Chris,

You can add the same RadBinaryImage definition to the edit template of the template column (as I suggested) to visualize the image as part of the RadGrid edit form. How to perform manual update/insert operation to replace the existing image with different one you can see from the sample code snippets of the online demo I pointed previously.

Regards,

Sebastian
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
Grid
Asked by
Chris Yoker
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Chris Yoker
Top achievements
Rank 1
Share this question
or