Error from FileUpload control using within RadGrid

Thread is closed for posting
1 posts, 0 answers
  1. John John
    John John avatar
    132 posts
    Member since:
    Aug 2009

    Posted 18 May 2011 Link to this post

    We  are trying to upload a file from a RadEditPopup which is opened from a Radgrid control. However, we could not get the file name from the RadUpload control. The RadUpload control returns a null value for the file name (it works properly when the control sits on a stand-alone page as in your web-demo for this control).  For your reference, I have  pasted code below which demonstrates the problem we are experiencing. Your prompt attention to this issue would be greatly appreciated. Thank you for your time, and we look forward to hearing from Telerik Support very soon.

    ASPX Code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <%@ Register Assembly="Telerik.Web.UI, Version=2009.3.1103.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
        Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
        <script language="javascript">  
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            <telerik:RadGrid ID="RadFormsLibrary" runat="server" AutoGenerateColumns="false"
                Skin="Vista" EnableLinqExpressions="false" Width="100%"
                <MasterTableView TableLayout="Fixed" Name="Forms" GroupLoadMode="Client" EditMode="PopUp"
                    AllowSorting="true" AllowMultiColumnSorting="True">
                    <HeaderStyle CssClass="HeaderStyle" />
                    <ItemStyle CssClass="ItemStyle" />
                    <AlternatingItemStyle CssClass="AlternatingItemStyle" />
                        <div style="background-color: Silver; height: 20px; color: Red; text-align: center;
                            font-size: 10pt; font-family: Verdana; font-weight: bold;">
                            <i>No forms defined for this application.</i>
                        <telerik:GridTemplateColumn HeaderText="Options" AllowFiltering="false" Reorderable="false"
                            Groupable="false" UniqueName="Options" HeaderStyle-Width="6%">
                                <asp:LinkButton ID="lnkEdit" CommandName="Edit" Text="Edit" runat="server"></asp:LinkButton>
                        <telerik:GridTemplateColumn HeaderText="EID" DataField="EID" UniqueName="EID" HeaderStyle-Width="7%">
                                <asp:Label ID="lblJuris" ToolTip='<%# Eval("EID") %>' runat="server"></asp:Label>
                    <EditFormSettings EditFormType="Template">
                        <PopUpSettings ScrollBars="Auto" Modal="true" />
                            <telerik:RadUpload ID="RUPhoto" runat="server" ControlObjectsVisibility="None" AllowedFileExtensions=".jpg,.jpeg"
                             <asp:Button ID="btnUpdate" runat="server" Text="Submit" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />

    Code Behind Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using Telerik.Web.UI;
    public partial class Default4 : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
        protected void Button1_Click(object sender, EventArgs e)
            string fileName = RUPhoto.UploadedFiles[0].FileName;
        public DataTable GetData()
            DataTable dt = new DataTable();
            for(int i=0;i<=5;i++)
                DataRow dr = dt.NewRow();
            return dt;
        protected void RadFormsLibrary_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
            DataTable dt=GetData();
            RadFormsLibrary.DataSource = dt;
        protected void RadFormsLibrary_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
            RadUpload rdFileName = e.Item.FindControl("dlFileName") as RadUpload;
            string fileName = rdFileName.UploadedFiles[0].FileName;

Back to Top