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

Setting the initial value of the textbox in RadUpload?

9 Answers 346 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 09 Aug 2011, 08:08 PM
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

9 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 12 Aug 2011, 02:31 PM
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.

0
Hemamalini
Top achievements
Rank 1
answered on 16 Dec 2011, 09:26 AM
Hi,


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


Thanks,
Hema.
0
Peter Filipov
Telerik team
answered on 19 Dec 2011, 06:23 PM
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
0
Basharat
Top achievements
Rank 1
answered on 26 Feb 2013, 12:08 AM
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
0
Peter Filipov
Telerik team
answered on 28 Feb 2013, 08:35 AM
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.
0
Basharat
Top achievements
Rank 1
answered on 28 Feb 2013, 03:50 PM
Thanks Peter it worked.
0
Erik
Top achievements
Rank 2
answered on 05 Aug 2013, 03:33 PM
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
0
Hristo Valyavicharski
Telerik team
answered on 08 Aug 2013, 10:50 AM
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.
0
Erik
Top achievements
Rank 2
answered on 19 Aug 2013, 02:51 PM
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.
Tags
Upload (Obsolete)
Asked by
Ryan
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Hemamalini
Top achievements
Rank 1
Basharat
Top achievements
Rank 1
Erik
Top achievements
Rank 2
Hristo Valyavicharski
Telerik team
Share this question
or