Setting the initial value of the textbox in RadUpload?

Thread is closed for posting
10 posts, 0 answers
  1. Ryan
    Ryan avatar
    3 posts
    Member since:
    Jul 2011

    Posted 09 Aug 2011 Link to this post

    Perhaps I'm just missing something obvious, but is it possible to set the initial value of the textbox in a RadUpload control?  I want it to display the filename of the existing file the upload would replace, but I can't find anything in the API that exposes the textbox's value.

    Thanks,
    Ryan
  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 12 Aug 2011 Link to this post

    Hi Ryan,

    You can use JQuery to set TextBox value.E.g.:

    $telerik.$(".ruFakeInput").attr("value","uploaded file name");


    Greetings,
    Peter Filipov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hemamalini
    Hemamalini avatar
    35 posts
    Member since:
    Jul 2010

    Posted 16 Dec 2011 Link to this post

    Hi,


          Is it possible to set textbox value with the help of server side events?


    Thanks,
    Hema.
  5. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 19 Dec 2011 Link to this post

    Hello Hemamalini,

    This is not possible because the textbox is rendered client-side. You can consider using OnClientAdded.

    Kind regards, Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Basharat
    Basharat avatar
    8 posts
    Member since:
    Dec 2012

    Posted 25 Feb 2013 Link to this post

    Hi,

    I want to set empty message in the textbox of radupload and remove the browse button. I have managed to remove the browse button but unlike other rad input controls there is no property "empty message " please guide.


    Thanks,
    Bash
  7. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 28 Feb 2013 Link to this post

    Hello Basharat,

    Please review the attached project. It shows how to handle the OnClientAdded event and set initial value to the input.

    Regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Basharat
    Basharat avatar
    8 posts
    Member since:
    Dec 2012

    Posted 28 Feb 2013 Link to this post

    Thanks Peter it worked.
  9. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 05 Aug 2013 Link to this post

    Hi,

    while googleling I found myself here, but do not really see an solution.

    How can I create a initial state like when an uploaded file was selected?
    I have an edit form. Since it is an edit, the file is already uploaded previously. I want to show this file name and the "remove" link. When clicking remove, the select/browse button is available and a other file can be selected... 

    Is it possible to show a file name on page load (JS, server side, I don't mind) like the image attached ?

    Erik
  10. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 08 Aug 2013 Link to this post

    Hi Eric,

    It is not possible to load files from server in RadAsyncUpload due to security reasons. You can load files only from the client and then upload them to the server. It is a one way operation. However it is possible to use JavaScript and make RadAsyncUpload to look like it has uploaded file. This will be only a visual indication. For example:
    <telerik:RadAsyncUpload
        ID="RadAsyncUpload1"
        OnClientFileUploadFailed="OnClientFileUploadFailed"
        OnClientValidationFailed="OnClientValidationFailed"
        TargetFolder="~/Uploads"
        runat="server">
    </telerik:RadAsyncUpload>
    <asp:HiddenField ID="HiddenFieldFileName" runat="server" />

    function pageLoad() {
        var HiddenFieldFileName = $get('HiddenFieldFileName').value;
        if (HiddenFieldFileName != "") {
            var fakeFile = '<span class="ruUploadProgress ruUploadSuccess">'+HiddenFieldFileName +'</span><input class="ruButton ruRemove" type="button" tabindex="-1" value="Remove" name="RowRemove" onclick="RemoveFile()">';
            $('#RadAsyncUpload1row0').html(fakeFile);
        }
    }
     
    function RemoveFile() {
        alert('Here call webservice which will remove selected file');
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HiddenFieldFileName.Value = "test.pdf";
    }

    When you click "remove" only visual indication will be removed. To make a physical file removal you could use web service.

    Regards,
    Hristo Valyavicharski
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  11. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 19 Aug 2013 Link to this post

    Thanks Hristo,

    Yes, only a fake solution Of course.

    I added a small design addition, because otherwise the green bullet is only half visible:

    change this (JS PageLoad):
    var fakeFile = '<span class="ruUploadProgress ruUploadSuccess">'+HiddenFieldFileName +'</span><input class="ruButton ruRemove" type="button" tabindex="-1" value="Remove" name="RowRemove" onclick="RemoveFile()">';

    to this:
    var fakeFile = '<span class="ruFileWrap ruStyled"><span class="ruUploadProgress ruUploadSuccess">'+HiddenFieldFileName +'</span></span><input class="ruButton ruRemove" type="button" tabindex="-1" value="Other File" name="RowRemove" onclick="RemoveFile()">';

    Regards,

    Erik.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017