RadUploadControl from GridBinaryImage Template Column

8 posts, 0 answers
  1. Philip
    Philip avatar
    70 posts
    Member since:
    Apr 2008

    Posted 10 May 2010 Link to this post

    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

         

  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 13 May 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Manuel Ortiz
    Manuel Ortiz avatar
    68 posts
    Member since:
    Aug 2009

    Posted 19 May 2010 Link to this post

    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
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 21 May 2010 Link to this post

    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.
  6. Manuel Ortiz
    Manuel Ortiz avatar
    68 posts
    Member since:
    Aug 2009

    Posted 21 May 2010 Link to this post

    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
  7. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 27 May 2010 Link to this post

    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.
  8. Manuel Ortiz
    Manuel Ortiz avatar
    68 posts
    Member since:
    Aug 2009

    Posted 27 May 2010 Link to this post

    Hey Genady... you forgot to put the link of the demo ;).. Thanks!
  9. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 28 May 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017