Set ViewPaths when in RadGrid EditForm

2 posts, 0 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 11 Oct 2012 Link to this post

    This is going to be a bit of odd one but here s what I am trying to do.  I have a aps.net page and on this page is  a radgrid.  The radgrid uses a Template for the Edit Form.  In this template I have a radtab strip.  On one tab is all the detail information for the record and the user can edit and save changes.  On the other table is a fileExplorer.  Now depending on which record is being entered the file paths need to be different, but for some reason when I am setting the ViewPath and UploadPaths in code it does not work, but if I set a static page in the html write up it work fine.

    I am trying to set the folder on the Radgrid databound event.
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
           {
               if (e.Item is GridEditableItem && e.Item.IsInEditMode)
               {
                   RadFileExplorer marketingFiles = (RadFileExplorer)formItem.FindControl("FileExplorer1");
     
                   string clientID = Session["AdvisorClientID"].ToString();
                   string id = ((RadTextBox)editItem.FindControl("MarketingCode")).Text;
     
                   if (!Directory.Exists(Server.MapPath("~/FileManager/") + clientID + "\\marketing\\" + id + "\\"))
                             Directory.CreateDirectory(Server.MapPath("~/FileManager/") + clientID + "\\marketing\\" + id + "\\");
                   string[] folder = new string[] { Server.MapPath("~/FileManager/") + clientID + "\\marketing\\" + id + "\\"};
     
                   marketingFiles.Configuration.ViewPaths = folder;
                   marketingFiles.Configuration.UploadPaths = folder;
               }

    It will create the folder if it does not exist.
     and this is the pageview html
    <telerik:RadPageView ID="RadPageView2" runat="server" BorderStyle="Inset" BorderWidth="1px" BorderColor="LightBlue">                                        
       <telerik:RadFileExplorer runat="server" ID="FileExplorer1" Width="600px" Height="250px" AllowPaging="true" PageSize="20" Skin="WebBlue">
             <Configuration EnableAsyncUpload="true" /></telerik:RadFileExplorer></telerik:RadPageView>

    the screen is also ajaxed, so I am not sure if that is the issue.
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
           EnablePageHeadUpdate="False" OnAjaxRequestquest="RadAjaxManager1_AjaxRequest"
           OnAjaxRequest="RadAjaxManager1_AjaxRequest">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="FilterButton">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="RemoveFilterButton">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                       <telerik:AjaxUpdatedControl ControlID="TypeListBox" />
                       <telerik:AjaxUpdatedControl ControlID="StatusListBox" />
                       <telerik:AjaxUpdatedControl ControlID="DescriptionTxt" />
                       <telerik:AjaxUpdatedControl ControlID="StartDate" />
                       <telerik:AjaxUpdatedControl ControlID="EndDate" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="RadGrid1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>

    thanks,
    Eric
  2. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 12 Oct 2012 Link to this post

    I have tested the code in a separate form and on the load event of the page it works fine.

    RadFileExplorer1.Configuration.ViewPaths = new string[] { "~/FileManager/" + Session["AdvisorClientID"].ToString() + "/" };

    but yet when set in on the RadGrid1_ItemDataBound
    RadFileExplorer fileManager = (RadFileExplorer)editItem.FindControl("RadFileExplorer1");
                fileManager.Configuration.ViewPaths = new string[] { "~/FileManager/" + Session["AdvisorClientID"].ToString() +"/"};

    does not work
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top