How to get the value of a text field created dynamically using Raduploader in code?

I am using AsyncUpload


 <telerik:RadAsyncUpload runat="server" ID="rada_attach" OnClientFileUploaded="onClientFileUploaded"
                                MultipleFileSelection="Disabled" InitialFileInputsCount="1" MaxFileInputsCount="1"
                                Width="100%" />

function onClientFileUploaded(radAsyncUpload, args) {
    var row = args.get_row(),
        inputName = radAsyncUpload.getAdditionalFieldID("TextBox"),
        inputType = "text",
        inputID = inputName,
        input = createInput(inputType, inputID, inputName),
        label = createLabel(inputID),
        br = document.createElement("br");

    row.appendChild(br);
    row.appendChild(input);
    row.appendChild(label);

}

function createInput(inputType, inputID, inputName) {
    var input = document.createElement("input");

    input.setAttribute("type", inputType);
    input.setAttribute("id", inputID);
    input.setAttribute("name", inputName);

    return input;
}

I want to access a text field (which was created dynamically) in .cs.

How to do it?


Full answer:

var $ = $telerik.$;

function onClientFileUploaded(radAsyncUpload, args) {
    var $row = $(args.get_row());
    var inputName = radAsyncUpload.getID("TextBox");
    var inputType = "text";
    var inputID = inputName;
    var input = createInput(inputType, inputID, inputName);
    var label = createLabel(inputID);
    $row.append("<br/>");
    $row.append(label);
    $row.append(input);
}

function createInput(inputType, inputID, inputName) {
    var input = '<input type="' + inputType + '" id="' + inputID + '" name="' + inputName + '" />';
    return input;
}

function createLabel(forArrt) {
    var label = '<label for=' + forArrt + '>info: </label>';
    return label;
}

   foreach (UploadedFile UF in rada_attach.UploadedFiles)
                {
                    if (UF.GetFieldValue("TextBox") != null)
                    {
                        OBJ.File_name = UF.GetFieldValue("TextBox");
                    }
                    else
                    {
                        OBJ.File_name = UF.GetName();
                    }
+5
source share
2 answers

In my opinion, the documentation is clear. Check the Description tab on the page you're linking to. You can access the value of dynamic text fields with the code below for postback:

if (rada_attach.UploadedFiles.Count > 0) {
    for (var index = 0; index < rada_attach.UploadedFiles.Count; ++index) {
        var textBoxValue = rada_attach.UploadedFiles[index].GetFieldValue("TextBox");
    }
}

By the way, this scenario is very good here: Adding information to downloaded files

+2
source

Request.Form ( ) , .

, /id , ? , name , Request .cs.

, , .cs

+2

All Articles