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

Using RadAsyncUpload in a popup formtemplate

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jhon Jairo Zapata Montealegre
Top achievements
Rank 1
Jhon Jairo Zapata Montealegre asked on 05 Aug 2010, 05:41 PM
Hi, I'm trying to use a RadAsyncUpload and a RadBinaryImage like in this example http://demos.telerik.com/aspnet-ajax/upload/examples/async/ajaxprocessing/defaultcs.aspx, but in a popup formtemplate, everything works fine, but the FileUploaded event of the RadAsyncUpload never fires. I have attached the aspx and code behind, this aspx has a master page.

<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"<br>    CodeBehind="lstUsuarios.aspx.cs" Inherits="SistemaCIRI.Admin.lstUsuarios" %><br><br><asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"><br></asp:Content><br><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceMain" runat="server"><br><br>    <script type="text/javascript"><br>        function fileUploaded(sender, args) {<br>            $find('rgUsuarios').ajaxRequest();<br>            sender.deleteFileInputAt(0);<br>        }<br>    </script><br><br>    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"><br>        <ajaxsettings><br>            <telerik:AjaxSetting AjaxControlID="rgUsuarios"><br>                <UpdatedControls><telerik:AjaxUpdatedControl ControlID="rgUsuarios" /></UpdatedControls><br>            </telerik:AjaxSetting><br>        </ajaxsettings><br>    </telerik:RadAjaxManager><br>    <telerik:RadAjaxManager ID="RadAjaxManager2" runat="server"><br>        <ajaxsettings><br>            <telerik:AjaxSetting AjaxControlID="RadAjaxManager2"><br>                <UpdatedControls><br>                <telerik:AjaxUpdatedControl ControlID="Thumbnail" /><br>                </UpdatedControls><br>            </telerik:AjaxSetting><br>        </ajaxsettings><br>    </telerik:RadAjaxManager><br>    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"><br>    </telerik:RadScriptManager><br>    <div class="clear"><br>    </div><br>    <div style="width: 960px; height: 80px; font-size: 16px;" class="bkgHeader"><br>        <table cellpadding="0" cellspacing="0" border="0" style="padding-top: 5px;"><br>            <tr><br>                <td style="width: 100px; vertical-align: middle; text-align: center;"><br>                    <asp:Image ID="imgLogoCIA" ImageUrl="../imagenes/logosAseguradoras/lg_fasecolda.jpg"<br>                        runat="server" Width="90px" Height="70px" /><br>                </td><br>                <td style="width: 300px;"><br>                    <table style="width: 280px;" cellpadding="0" cellspacing="0" border="0"><br>                        <tr><br>                            <td align="left" style="font: bold 14px Verdana;"><br>                                Fasecolda<br>                            </td><br>                        </tr><br>                        <tr><br>                            <td align="left" style="font: 12px Verdana;"><br>                                Nombre Apellido1 Apellido2<br>                            </td><br>                        </tr><br>                        <tr><br>                            <td colspan="2" style="height: 19px;"><br>                            </td><br>                        </tr><br>                        <tr><br>                            <td align="left" style="font: 9px Verdana;"><br>                                &Uacute;ltima actualizaci&oacute;n:<br>                                <asp:Label ID="lblUltAct" Text="20/Julio/2010" runat="server" /><br>                            </td><br>                        </tr><br>                    </table><br>                </td><br>                <td style="width: 450px;" rowspan="2" align="center"><br>                    <table cellpadding="0" cellspacing="0" border="0"><br>                        <tr><br>                            <td colspan="2" style="font: bold 14px Verdana;"><br>                                GESTI&Oacute;N DE USUARIOS<br>                            </td><br>                        </tr><br>                        <tr><br>                            <td colspan="2" style="height: 10px;"><br>                            </td><br>                        </tr><br>                    </table><br>                </td><br>                <td align="left" style="width: 20px; font: 9px Verdana; vertical-align: bottom;"><br>                    Fecha<br>                    <asp:Label ID="lblFechaActual" Text="20/Julio/2010" runat="server" /><br>                </td><br>            </tr><br>        </table><br>    </div><br>    <div class="clear"><br>    </div><br>    <div style="width: 960px; padding-top: 20px;"><br>        <table style="padding-top: 20px;" cellpadding="0" cellspacing="0" border="0"><br>            <tr><br>                <td style="width: 390px;"><br>                    <b>B&uacute;squeda por No. identificaci&oacute;n</b>&nbsp;&nbsp;<asp:TextBox ID="txtBuscarUsuario"<br>                        Width="200px" runat="server" /><br>                </td><br>                <td><br>                    <asp:ImageButton ID="btnBuscarUsuario" runat="server" AlternateText="Buscar" ImageAlign="Middle"<br>                        ImageUrl="../imagenes/btnBuscar.png" OnClick="btnBuscarUsuario_Click" /><br>                </td><br>            </tr><br>        </table><br>        <table style="padding-top: 20px; padding-bottom: 50px;" cellpadding="0" cellspacing="0"<br>            border="0"><br>            <tr><br>                <td><br>                    <telerik:RadGrid ID="rgUsuarios" runat="server" Skin="Vista" ShowStatusBar="True"<br>                        AllowAutomaticInserts="false" AllowAutomaticUpdates="false" OnUpdateCommand="rgUsuarios_UpdatedCommand"<br>                        OnInsertCommand="rgUsuarios_InsertedCommand" OnNeedDataSource="rgUsuarios_NeedDataSource"<br>                        OnItemDataBound="rgUsuarios_ItemDataBound" onitemcommand="rgUsuarios_ItemCommand"><br>                        <mastertableview nomasterrecordstext="No hay resultados para esta busqueda." commanditemdisplay="TopAndBottom"<br>                            autogeneratecolumns="False" allowsorting="True" editmode="PopUp" width="1020px"><br><br>                            <AlternatingItemStyle BackColor="#E0E0E0" /><br><br>                            <PagerStyle FirstPageToolTip="Primera Página" LastPageToolTip="Ultima Página"<br>                                NextPageToolTip="Página Siguiente"<br>                                PagerTextFormat="Change page: {4} &amp;nbsp;Página &lt;strong&gt;{0}&lt;/strong&gt; de &lt;strong&gt;{1}&lt;/strong&gt;, items &lt;strong&gt;{2}&lt;/strong&gt; a &lt;strong&gt;{3}&lt;/strong&gt; de &lt;strong&gt;{5}&lt;/strong&gt;." <br>                                PageSizeLabelText="Tamaño página:" PrevPageToolTip="Página Anterior"<br>                            /><br><br>                            <CommandItemSettings<br>                                ShowExportToWordButton="true" ShowExportToExcelButton="true"<br>                                ShowExportToCsvButton="true" ShowExportToPdfButton="true"<br>                                ShowAddNewRecordButton="true"<br>                                AddNewRecordText="Nuevo usuario" ExportToCsvText="Exportar a CSV"<br>                                ExportToExcelText="Exportar a Excel" ExportToPdfText="Exportar a PDF"<br>                                ExportToWordText="Exportar a Word" RefreshText="Refrescar"<br>                            /><br><br>                            <Columns><br>                                <telerik:GridBoundColumn DataField="IdUsuario" HeaderText="idUsuario" HeaderStyle-HorizontalAlign="Center" Visible="false" /><br>                                <telerik:GridBoundColumn DataField="Compania"  HeaderText="COMPAÑ&Iacute;A" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="100px" /><br>                                <telerik:GridBoundColumn DataField="Login"     HeaderText="LOGIN" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="150px" /><br>                                <telerik:GridBoundColumn DataField="numIdUsuario" HeaderText="IDENTIFICACION" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="150px" /><br>                                <telerik:GridBoundColumn DataField="Nombre"    HeaderText="NOMBRES" UniqueName="txtNombres" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="160px" /><br>                                <telerik:GridBoundColumn DataField="Apellidos" HeaderText="APELLIDOS" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="160px" /><br>                                <telerik:GridBoundColumn DataField="Email"     HeaderText="EMAIL" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="150px" /><br>                                <telerik:GridBoundColumn DataField="Activo"    HeaderText="ACTIVO" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Width="50px" ItemStyle-HorizontalAlign="Center" /><br>                                <telerik:GridEditCommandColumn EditText="Modificar" HeaderText="OPCIONES" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" UpdateText="Update" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" /><br>                            </Columns><br><br>                            <EditFormSettings InsertCaption="Informaci&oacute;n Usuario" EditFormType="Template" PopUpSettings-Modal="true" ><br>                                <EditColumn UniqueName="EditCommandColumn1" /><br>                                <FormTemplate><br>                                    <table id="tabla1" width="320px" cellspacing="1" cellpadding="1" border="0"><br>                                        <tr><br>                                            <td style="width:120px;height:20px;"></td><br>                                            <td style="width:200px;height:20px;"><asp:TextBox ID="txtIdUsuario" Text='<%# Bind("IdUsuario") %>' runat="server" Visible="false" /></td><br>                                        </tr><br>                                        <tr><br>                                            <td><b>No. Identificaci&oacute;n</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <asp:TextBox ID="txtNumIdentificacion" Text='<%# Bind("numIdUsuario") %>' runat="server" Width="200px" /><br>                                                <asp:RequiredFieldValidator ID="rfvTxtNumIdentificacion" ControlToValidate="txtNumIdentificacion" runat="server" Display="Dynamic" ErrorMessage="*Campo requerido" /><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Nombres</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <asp:TextBox ID="txtNombres" Text='<%# Bind("Nombre") %>' runat="server" Width="200px" /><br>                                                <asp:RequiredFieldValidator ID="rfvTxtNombres" ControlToValidate="txtNombres" runat="server" Display="Dynamic" ErrorMessage="*Campo requerido" /><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Apellidos</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <asp:TextBox ID="txtApellidos" Text='<%# Bind("Apellidos") %>' runat="server" Width="200px" /><br>                                                <asp:RequiredFieldValidator ID="rfvTxtApellidos" ControlToValidate="txtApellidos" runat="server" Display="Dynamic" ErrorMessage="*Campo requerido" /><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Cargo</b></td><br>                                            <td><asp:TextBox ID="txtCargo" Text='<%# Bind("Cargo") %>' runat="server" Width="200px" /></td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Tel&eacute;fono</b></td><br>                                            <td><asp:TextBox ID="txtTelefono" Text='<%# Bind("Telefono1") %>' runat="server" Width="200px" /></td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Email</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <asp:TextBox ID="txtEmail" Text='<%# Bind("Email") %>' runat="server" Width="200px" /><br>                                                <asp:RequiredFieldValidator ID="rfvTxtEmail" ControlToValidate="txtEmail" runat="server" Display="Dynamic" ErrorMessage="*Campo requerido" /><br>                                                <asp:RegularExpressionValidator<br>                                                    id="emailValidator" runat="server"<br>                                                    Display="Dynamic" ErrorMessage="<p>Ingrese un e-mail valido.</p>"<br>                                                    ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"<br>                                                    ControlToValidate="txtEmail"><br>                                                </asp:RegularExpressionValidator><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Compañ&iacute;a</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><telerik:RadComboBox ID="rcbCompanias" runat="server" Width="204px"  /></td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Perfil</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><telerik:RadComboBox ID="rcbPerfiles" runat="server" Width="204px"  /></td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Login</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <asp:TextBox ID="txtLogin" Text='<%# Bind("Login") %>' runat="server" Width="200px" /><br>                                                <asp:RequiredFieldValidator ID="rfvTxtLogin" ControlToValidate="txtLogin" runat="server" Display="Dynamic" ErrorMessage="*Campo requerido" /><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Password</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <asp:TextBox ID="txtPassword" Text='<%# Bind("Password") %>' runat="server" Width="200px" /><br>                                                <asp:RequiredFieldValidator ID="rfvTxtPassword" ControlToValidate="txtPassword" runat="server" Display="Dynamic" ErrorMessage="*Campo requerido" /><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:5px;"></td></tr><br>                                        <tr><br>                                            <td><b>Activo</b><img src="../imagenes/dot.gif" alt="Requerido" /></td><br>                                            <td><br>                                                <telerik:RadComboBox ID="rcbActivo" runat="server" Width="204px" SelectedValue='<%#Bind("Activo")%>' ><br>                                                    <Items><br>                                                        <telerik:RadComboBoxItem Text="Si" Value="Si" runat="server" /><br>                                                        <telerik:RadComboBoxItem Text="No" Value="No" runat="server" /><br>                                                    </Items><br>                                                </telerik:RadComboBox><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:10px;"></td></tr><br>                                        <tr>    <br>                                            <td colspan="2"><br>                                                La informaci&oacute;n en los campos marcados (<img src="../imagenes/dot.gif" alt="Requerido" />) es obligatoria<br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:15px;"></td></tr><br>                                        <tr><br>                                            <td align="center" colspan="2"><br>                                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? " Grabar " : " Actualizar " %>'<br>                                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /><br>                                                &nbsp;&nbsp;<br>                                                <asp:Button ID="btnCancelar" Text=" Cancelar " runat="server" CausesValidation="False" CommandName="Cancel" /><br>                                            </td><br>                                        </tr><br>                                        <tr><td colspan="2" style="height:20px;"></td></tr><br>                                    </table><br>                                    <telerik:RadBinaryImage ID="Thumbnail" runat="server" /><br>                                    <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" OnFileUploaded="AsyncUpload1_FileUploaded" OnClientFileUploaded="fileUploaded" MaxFileInputsCount="1" ><br>                                    </telerik:RadAsyncUpload><br>                                    <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Bind("IdPerfil") %>' /><br>                                </FormTemplate><br>                            </EditFormSettings><br><br>                        </mastertableview><br>                    </telerik:RadGrid><br>                </td><br>            </tr><br>        </table><br>    </div><br></asp:Content>

Code Behind
protected void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e) { Thumbnail.Width = Unit.Pixel(200); Thumbnail.Height = Unit.Pixel(150); byte[] imageData = new byte[e.File.InputStream.Length]; using (Stream stream = e.File.InputStream){ stream.Read(imageData, 0, (int)e.File.InputStream.Length);}Thumbnail.DataValue = imageData; }

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 11 Aug 2010, 08:53 AM
Hello Jhon,

I tried to reproduce the described issue, but to no avail. I am sending you a simple example which demonstrates the desired functionality. Please check it out and let me know if it helps you.
Also, please note that the FileUploaded event handler will be fired after page's postback.

I hope this helps.

Kind regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Jhon Jairo Zapata Montealegre
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or