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

Problem with java script in ajax panel

0 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
shadow
Top achievements
Rank 2
shadow asked on 14 Aug 2012, 11:09 AM
Hello,
Below is my code I am using and getting this error
TypeError: uploadbutton is null 

This code is placed in a rad window.



<telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
<div style="margin-left: 5px">
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" HorizontalAlign="NotSet">
        <asp:HiddenField ID="hfGalleryID" runat="server" Value="0" />
        <asp:HiddenField ID="hfContentItemID" runat="server" Value="0" />
        <telerik:RadDockZone ID="RadDockZone1" runat="server" Style="border: 0px; width: 98%;">
            <ModuleControls:ConfigurationDockHeader ID="GalleryEditConfigurationArea" runat="server" Title="ManageBase Gallery" DockMode="Docked"
                Collapsed="True" DefaultCommands="ExpandCollapse" EnableRoundedCorners="true" EnableAnimation="True" Index="0" Tag=""
                Width="">
                <Commands>
                    <telerik:DockExpandCollapseCommand />
                    <telerik:DockToggleCommand AutoPostBack="true" Text="" Name="CommandSaveGallery" />
                </Commands>
                <ContentTemplate>
                    <table border="0" cellpadding="2" cellspacing="1" width="100%">
                        <tr>
                            <td>
                                <asp:Literal ID="ltrSelectGallery" runat="server" Text="Administrera"></asp:Literal>
                            </td>
                            <td>
                                <asp:Literal ID="ltrGalleryName" runat="server" Text="Gallery-namn"></asp:Literal>
                            </td>
                            <td>
                                <asp:Literal ID="ltrGallerystill" runat="server" Text="Gallery still"></asp:Literal>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <GalleryControl:ImageGalleryDropDown ID="ddlImageGallerys" runat="server" EmptyMessage="Välj Galleri" AutoPostBack="True">
                                </GalleryControl:ImageGalleryDropDown>
                            </td>
                            <td>
                                <telerik:RadTextBox runat="server" ID="txtGalleryName" Columns="23" Skin="">
                                </telerik:RadTextBox>
                            </td>
                            <td>
                                <GalleryControl:GelleryViewTypeDropDown ID="ddlGalleryPreviewType" runat="server" EmptyMessage="Välj still" AutoPostBack="True">
                                </GalleryControl:GelleryViewTypeDropDown>
                            </td>
                            <td>
                                <telerik:RadButton ID="btnUpdateGallery" CssClass="glUpdateGalleryStrip" Text="" runat="server">
                                    <Image EnableImageButton="true" IsBackgroundImage="true" />
                                </telerik:RadButton>
                            </td>
                            <td>
                                <telerik:RadButton ID="btnDeleteGallery" runat="server" CssClass="glDelete" HoveredCssClass="glDeleteHover" Text="">
                                    <Image EnableImageButton="true" IsBackgroundImage="true" />
                                </telerik:RadButton>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td colspan="2">
                                <telerik:RadButton ID="btnSaveGallery" runat="server" Text="Save new gallery">
                                </telerik:RadButton>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </ModuleControls:ConfigurationDockHeader>
        </telerik:RadDockZone>
        <div style="margin-top: 10px;">
            <asp:Panel ID="pnlDisplayGalleryConfiguration" runat="server">
                <table>
                    <tr>
                        <td>
                            <telerik:RadComboBox ID="ddlThunmnailSize" runat="server" AutoPostBack="true">
                                <Items>
                                    <telerik:RadComboBoxItem Text="100 X 60" Value="100-60" Selected="true" />
                                    <telerik:RadComboBoxItem Text="110 X 70" Value="110-70" />
                                    <telerik:RadComboBoxItem Text="120 X 80" Value="120-80" />
                                    <telerik:RadComboBoxItem Text="140 X 90" Value="140-90" />
                                    <telerik:RadComboBoxItem Text="170 X 120" Value="170-120" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                        <td>
                            <GalleryControl:FrameStyleDropDown ID="ddlBorder" runat="server" EmptyMessage="Välj inramning" AutoPostBack="True">
                            </GalleryControl:FrameStyleDropDown>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="ddlEffect" runat="server" EmptyMessage="Välj effekt">
                            </telerik:RadComboBox>
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Visning bredd pixl
                        </td>
                        <td>
                            <telerik:RadNumericTextBox runat="server" ID="txtImagePixelSize" Columns="23" Width="80px" ShowSpinButtons="true" Skin=""
                                DataType="System.Int32" MaxLength="4" MaxValue="1000" MinValue="400" Value="600">
                                <NumberFormat AllowRounding="False" ZeroPattern="n" />
                            </telerik:RadNumericTextBox>
                        </td>
                        <td>
                            <telerik:RadButton ID="btnOpenUploadWindow" runat="server" Text="Upload images">
                            </telerik:RadButton>
                        </td>
                        <td>
                              
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
                <asp:Panel ID="pnlImageGalleryPreview" runat="server">
                    <uc1:GalleryViewSimple ID="GalleryViewSimple1" runat="server" Visible="true"  />
                </asp:Panel>
            </asp:Panel>
            <asp:Panel ID="pnlUploadImages" runat="server" Visible="false">
                <div style="text-align: right;">
                    <telerik:RadButton ID="btnBackFromUpload" runat="server" Text="Back">
                    </telerik:RadButton>
                </div>
                <telerik:RadProgressManager runat="server" ID="RadProgressManager1" />
                <telerik:RadAsyncUpload ID="upImages" runat="server" MultipleFileSelection="Automatic" AllowedFileExtensions=".jpg,.png,.img,.jpeg"
                    PostbackTriggers="btnUploadToServer" OnClientFilesUploaded="onClientFileUploaded">
                </telerik:RadAsyncUpload>
                <telerik:RadProgressArea runat="server" ID="RadProgressArea1">
                </telerik:RadProgressArea>
                <telerik:RadButton ID="btnUploadToServer" runat="server" Text="Upload" Enabled="false" AutoPostBack="false" OnClientClicked="updatePictureAndInfo">
                </telerik:RadButton>
            </asp:Panel>
        </div>
        <telerik:RadScriptBlock ID="cdb" runat="server">
            <script type="text/javascript">
                function onClientFileUploaded(sender, args) {
                    var uploadbutton = $find("<%=btnUploadToServer.ClientID %>");
                    uploadbutton.set_enabled(true);
                }
 
                function updatePictureAndInfo() {
                    var upload = $find("<%=upImages.ClientID %>");
 
                    if (upload.getUploadedFiles().length > 0) {
                        __doPostBack('btnUploadToServer', 'btnUploadToServerArgs');
                    }
                    else {
                        alert("Please select a picture.");
                    }
                }          
            </script>
        </telerik:RadScriptBlock>
    </telerik:RadAjaxPanel>
</div>

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
shadow
Top achievements
Rank 2
Share this question
or