submit button in upload div

Thread is closed for posting
16 posts, 0 answers
  1. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 05 Nov 2008 Link to this post

    Ive been following the example in the help files for placing the submit button in the upload div and put the following javascrip in the page, when I load the page I get this error

    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
    <script type="text/javascript">  
    function pageLoad()  
    {  
       var upload = $find("<%= RadUpload1.ClientID %>");     
       var uploaduploadDiv = upload.get_element();  
         
       var input = document.createElement("input");  
       input.type = "submit";  
       input.className = "ruButton";  
       input.value = "Submit";  
       inputinput.id = input.name = upload.getID("submit");  
         
       //the UL element of the upload  
       var ul = uploadDiv.getElementsByTagName("UL");  
       //the array of all LI elements of the UL element  
       var LIs = ul[0].getElementsByTagName("LI");  
       //Last LI item - the button area  
       var lastLi = LIs[LIs.length - 1];  
       lastLi.appendChild(input);     
    }  
    </script>   
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 05 Nov 2008 Link to this post

    Hi mark wheeler,

    Please make sure that you have placed the javascript code outside the <head> tag on the page.
    Also, you can try surrounding the javascript code with RadScriptBlock.

    Kind regards,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mww
    mww avatar
    257 posts
    Member since:
    Sep 2012

    Posted 05 Nov 2008 Link to this post

    That worked great thanks.  I do have another problem though.  On my original submit button I had some server side code to resize the uploaded image and save to a database.  Creating the button client side has stopped this from working.  How do I re-associate the server side button click handler
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 07 Nov 2008 Link to this post

    Hi mark wheeler,

    I have created a sample page demonstrating how to achieve that. Please download it and give it a try.

    I hope this helps.

    Sincerely yours,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Jen
    Jen avatar
    21 posts
    Member since:
    Oct 2008

    Posted 06 May 2011 Link to this post

    Is it possible to move the submit button on a rad upload control that is inside of a rad grid template column?
  7. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 10 May 2011 Link to this post

    Hi Jen,

    Which is the exact control that you use - RadUpload or RadAsyncUpload?

    Regards,
    Helen
    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.

  8. Jen
    Jen avatar
    21 posts
    Member since:
    Oct 2008

    Posted 10 May 2011 Link to this post

    I am using the rad upload control
  9. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 11 May 2011 Link to this post

    Hello Jen,

    I believe that it is possible, have you tried the approach suggested by Veselin Vasilev?

    Regards,
    Genady Sergeev
    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.

  10. Jen
    Jen avatar
    21 posts
    Member since:
    Oct 2008

    Posted 11 May 2011 Link to this post

    The implementation that is suggested won't work for me.  I have a content page inside of a master page, the rad upload is inside of a template column inside of a rad grid.  Therefore there could be multiple rad uploads on the page.  I am not just finding one control on the page load of the master page.  Any suggestions that will work for my scenario?  If you are unable to help with this is a timely manner, please let me know and I will open a support ticket.
  11. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 12 May 2011 Link to this post

    Hello Jen,

    I am attaching sample project demonstrating how to achieve that functionality when RadUpload is inside RadGrid. The project is attached to this replay.

    All the best,
    Genady Sergeev
    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.

  12. Jen
    Jen avatar
    21 posts
    Member since:
    Oct 2008

    Posted 24 May 2011 Link to this post

    This will work, except I have one more "issue" that needs to be covered.  The template has a multiview in it that switches on item databound, so the rad upload is not on every row.  (See code below).  I added code to check for 'undefined', but it isn't finding the rad upload on any row.  How would I change the code to find it in a multiview on certain rows?

    <telerik:GridTemplateColumn HeaderText="Product Description" UniqueName="Description">
                                <ItemTemplate>
                                    <asp:MultiView ID="MultiViewType" runat="server">
                                        <asp:View ID="ViewTextBox" runat="server">
                                            <telerik:RadEditor ID="RadEditorDescription" runat="server" Content='<%# Eval("ProductSpecificationDescription") %>'
                                                ContentFilters="FixUlBoldItalic, MozEmStrong, ConvertFontToSpan, ConvertToXhtml, FixEnclosingP"
                                                EditModes="Design" ToolsFile="~/App_Data/LimitedTools.xml"
                                                Width="275px" Height="150px"
                                                ContentAreaCssFile="~/App_Themes/EditorContentAreaStyles.css"
                                                AllowScripts="False">
                                            </telerik:RadEditor>
                                        </asp:View>
                                        <asp:View ID="ViewLabel" runat="server">
                                            <asp:Label ID="LabelColors" runat="server" Text='<%#Eval("ProductSpecificationDescription") %>'></asp:Label>
                                        </asp:View>
                                        <asp:View ID="ViewFileUpload" runat="server">
                                            <asp:Label ID="LabelCurrentFile" runat="server"></asp:Label>
                                             <telerik:RadUpload ID="RadUploadFile" runat="server"  
                                               OverwriteExistingFiles="true" InitialFileInputsCount="1"  
                                               ControlObjectsVisibility="None" InputSize="40">
                                               <Localization Select="Browse" />             
                                            </telerik:RadUpload>
                                            <asp:Button ID="ButtonUpload" runat="server" Text="Upload" CommandName="FileUpload" />
                                        </asp:View>
                                    </asp:MultiView>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
  13. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 26 May 2011 Link to this post

    Hi Jen,

    Please find attached the modified project. Hope it helps.


    Best wishes,
    Helen
    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.

  14. Jen
    Jen avatar
    21 posts
    Member since:
    Oct 2008

    Posted 31 May 2011 Link to this post

    That example does work for creating the button inside of the upload container, however, you will see in my markup that I need this button to have a command name and cause a post back.  Is that possible with the code you have given me?
  15. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 01 Jun 2011 Link to this post

    Hello Jen,

    Our button has a "CommandName' too.
    Do you experience any problem with this implementation?
    If yes - could you please open a support ticket and send us a sample which demonstrates the issue to examine it locally?

    Kind regards,
    Helen
    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.

  16. Jen
    Jen avatar
    21 posts
    Member since:
    Oct 2008

    Posted 10 Jun 2011 Link to this post

    Yes, the button that is coded in the markup has a command name on it, but the purpose of this was to move that button inside of the upload container.  Your code is doing that by creating a "new" submit button, therefore, if I understand correctly,  the other button would be removed.  Your "new" submit button doesn't have a command name on it.  Am I missing something?
  17. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 16 Jun 2011 Link to this post

    Hello Jen,

    I've updated the sample with the desired functionality. You can  find it as an attachment.

    Regards,
    Genady Sergeev
    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.

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