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

RadUploadControl from GridBinaryImage Template Column

7 Answers 30 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 10 May 2010, 10:27 PM
I would like to create a page in the fashion of your demo shown in http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=binaryimage

I have made a slight change, and do not know how to adjust the VB code to compensate for it.

I have changed the code below from : 
 <telerik:GridBinaryImageColumn DataField="Data" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
                        ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" DataAlternateTextField="Description"
                        DataAlternateTextFormatString="Image of {0}">
                        <HeaderStyle Width="10%" />
                    </telerik:GridBinaryImageColumn>


to the following code:

<

 

telerik:GridTemplateColumn >

 

 

<ItemTemplate>

 

 

<telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" DataValue = '<%# Eval("Document") %>' ResizeMode = "Fit" Height="150px" Width="150px" />

 

 

<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="radBinaryImage1" Position="Center">

 

 

<telerik:RadBinaryImage ID="RadBinaryImage2" runat="server" DataValue = '<%# Eval("Document") %>' ResizeMode = "Fit" Height="800px" Width="600px" />

 

 

 

</telerik:RadToolTip>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 



The problem I am having is with the VB code below that is in bold and Italics. How do I change this code to work with the GridTemplateColumn, instead of the Gridbinaryimagecolumn?



Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
            If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
                Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)


                Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl


                RadAjaxPanel1.ResponseScripts.Add(String.Format("window['UploadId'] = '{0}';", upload.ClientID))
            End If
        End Sub

        Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
            If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
                Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)


                Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl


                Dim validator As CustomValidator = New CustomValidator()
                validator.ErrorMessage = "Please select file to be uploaded"
                validator.ClientValidationFunction = "validateRadUpload"
                validator.Display = ValidatorDisplay.Dynamic
                DirectCast(upload.Parent, TableCell).Controls.Add(validator)
            End If
        End Sub

     

7 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 13 May 2010, 11:05 AM
Hello Philip,

To implement the desired functionality, you could add a RadUpload control in the EditItemTemplate of the corresponding column.
Then, the AJAX functionality should be disabled when the upload button is clicked.

For additional information, please take a look at the File upload in ajaxified grid help topic.

Kind regards,
Mira
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
Manuel Ortiz
Top achievements
Rank 1
answered on 20 May 2010, 03:47 AM
Hi,

What if I limit the radupload's AllowedFileExtensions to "jpg" and "gif" wouldn't the radupload control validate automatically if I upload another type of extension??  Or the validator will be needed anyways?

Thanks,
Manuel
0
Mira
Telerik team
answered on 21 May 2010, 03:22 PM
Hello Manuel,

RadUpload provides the client-side function validateExtensions, which validates file extensions on the client.
You can see how it works in this demo - Upload / Client-side Validation.

If you want the validation to be performed server-side, please handle the ServerValidate event of the CustomValidator in code-behind.

Sincerely yours,
Mira
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
Manuel Ortiz
Top achievements
Rank 1
answered on 21 May 2010, 03:36 PM
Ok thanks!!

One more question... What is the purpose of the RadProgressManager and RadProgressArea?? I was searching but I could not find any documentation for those controls.

Thank you,
Manuel
0
Genady Sergeev
Telerik team
answered on 27 May 2010, 07:55 AM
Hi Manuel Ortiz,

Information for the purpose of RadProgressArea can be found here. If you want to see the area in action, please take a look at the following demo. Select a file and the area should appear providing visual information regarding the upload process.

Sincerely yours,
Genady Sergeev
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
Manuel Ortiz
Top achievements
Rank 1
answered on 27 May 2010, 02:18 PM
Hey Genady... you forgot to put the link of the demo ;).. Thanks!
0
Genady Sergeev
Telerik team
answered on 28 May 2010, 04:07 PM
Hi Manuel Ortiz,

My bad, here it is. The demo

Best wishes,
Genady Sergeev
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
BinaryImage
Asked by
Philip
Top achievements
Rank 1
Answers by
Mira
Telerik team
Manuel Ortiz
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or