How to add a combobox to the upload control

Thread is closed for posting
4 posts, 0 answers
  1. Dan Harvey
    Dan Harvey avatar
    67 posts
    Member since:
    Jul 2008

    Posted 16 Jan 2012 Link to this post


    I would like to add a simple combox (not telerik) with items in it as an additional field to the RadUpload control.

    Here is my code:

    <%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MultiFileUploadPrototype._Default" %>
    <%@ register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
        <head id="Head1" runat="server">
            <link rel="stylesheet" type="text/css" href="styles.css" />
        <body class="BODY">
            <form runat="server" id="mainForm" method="post">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
            <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" />
                    <td class="TopCell" colspan="2">
                    <td class="BodyCell">
                        <div class="FileDetails">
                            <telerik:RadAsyncUpload runat="server" 
                    <td class="BodyCell RightCell">             
                        <div class="uploadedfiles">
                                <asp:Label ID="labelNoResults" runat="server" Visible="True">No uploaded files</asp:Label>
                                <asp:Repeater runat="server" ID="Repeater1">
                                        Category: <%#((Telerik.Web.UI.UploadedFile)Container.DataItem).GetFieldValue("TextBox").ToString()%>,<br />
                                        File name: <%# DataBinder.Eval(Container.DataItem, "FileName").ToString() %>,<br />
                                        File size: <%# DataBinder.Eval(Container.DataItem, "ContentLength").ToString() %><br />
                                        <br />
                                        <br />
                    <td class="BottomCell" colspan="2">
                        <asp:Button ID="buttonSubmit" runat="server" CssClass="RadUploadButton" OnClick="buttonSubmit_Click" Text="Submit" />
                <telerik:RadProgressArea runat="server" ID="ProgressArea1"></telerik:RadProgressArea>
                <script type="text/javascript">
                    var $ = $telerik.$;
                    function onClientFileUploaded(radAsyncUpload, args) {
                        var $row = $(args.get_row());
                        var categoryInputName = radAsyncUpload.getAdditionalFieldID("TextBox");
                        var categoryInputType = "text";
                        var categoryInputID = categoryInputName;
                        var categoryInput = createInput(categoryInputType, categoryInputID, categoryInputName);
                        var categoryLabel = createLabel(categoryInputID, "Category");
    //                    var subCategoryInputName = radAsyncUpload.getAdditionalFieldID("ComboBox");
    //                    var subCategoryInputID = subCategoryInputName;
    //                    var subCategoryInput = createComboBox(subCategoryInputID);
    //                    var subCategoryLabel = createLabel(subCategoryInputID, "Category");
    //                    $row.append("<br/>");
    //                    $row.append(subCategoryLabel);
    //                    $row.append(subCategoryInput);
                    function createInput(inputType, inputID, inputName) {
                        var input = '<input type="' + inputType + '" id="' + inputID + '" name="' + inputName + '" />';
                        return input;
    //                function createComboBox(inputID) {
    //                    var cmbBox = '<telerik:RadComboBox id="' + inputID + '" />';
    //                    return cmbBox;
    //                }
                    function createLabel(forArrt, labelName) {
                        var label = '<label for=' + forArrt + '>' + labelName + ': </label>';
                        return label;

    Please help.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jan 2012 Link to this post

    Hello Dan,

    Check the following forum thread which discussed similar scenario.
    rad combo box in radUpload
    Also take a look at the following help documentation.
    Adding Information to Uploaded Files.

  3. Dan Harvey
    Dan Harvey avatar
    67 posts
    Member since:
    Jul 2008

    Posted 17 Jan 2012 Link to this post

    Wait i'm confused, so could you please verify that the RadUpload does not support simple comboboxes (not telerik comboboxes, but asp comboboxes).

  4. Richard
    Richard avatar
    479 posts
    Member since:
    Nov 2011

    Posted 18 Jan 2012 Link to this post


    The rad combo box in radUpload forum thread states that it is far simpler to use standard ASP.NET controls than to implement RadControls in association with the RadUpload control. But, most importantly, the additional fields must provide text or boolean values.

    I'm thinking that you should let the ASP ComboBox initiate the postback and trigger the upload, instead of a "Submit" button. Then, on the server-side, you'd subscribe to one of it's events to get the selected text value and do something with it.

    You'd have to insure that a file has been selected prior to enabling the combobox to prevent postback without a file.

    I am working on a simple sample and will update this thread soon, as time permits.

Back to Top