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

submit button in upload div

15 Answers 185 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 05 Nov 2008, 10:06 AM
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>   

15 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 05 Nov 2008, 10:45 AM
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.
0
mww
Top achievements
Rank 1
answered on 05 Nov 2008, 11:19 AM
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
0
Veselin Vasilev
Telerik team
answered on 07 Nov 2008, 02:57 PM
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.
0
Jen
Top achievements
Rank 1
answered on 06 May 2011, 03:10 PM
Is it possible to move the submit button on a rad upload control that is inside of a rad grid template column?
0
Helen
Telerik team
answered on 10 May 2011, 05:53 PM
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.

0
Jen
Top achievements
Rank 1
answered on 10 May 2011, 05:54 PM
I am using the rad upload control
0
Genady Sergeev
Telerik team
answered on 11 May 2011, 09:19 AM
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.

0
Jen
Top achievements
Rank 1
answered on 11 May 2011, 02:36 PM
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.
0
Genady Sergeev
Telerik team
answered on 12 May 2011, 06:07 PM
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.

0
Jen
Top achievements
Rank 1
answered on 24 May 2011, 05:16 PM
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>
0
Helen
Telerik team
answered on 26 May 2011, 01:45 PM
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.

0
Jen
Top achievements
Rank 1
answered on 31 May 2011, 02:18 PM
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?
0
Helen
Telerik team
answered on 01 Jun 2011, 04:36 PM
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.

0
Jen
Top achievements
Rank 1
answered on 10 Jun 2011, 09:08 PM
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?
0
Genady Sergeev
Telerik team
answered on 16 Jun 2011, 11:26 AM
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.

Tags
Upload (Obsolete)
Asked by
mww
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
mww
Top achievements
Rank 1
Jen
Top achievements
Rank 1
Helen
Telerik team
Genady Sergeev
Telerik team
Share this question
or