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

Set ViewPaths when in RadGrid EditForm

1 Answer 73 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 11 Oct 2012, 08:08 PM

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

1 Answer, 1 is accepted

Sort by
0
Eric Klein
Top achievements
Rank 1
answered on 12 Oct 2012, 08:28 PM
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
Tags
FileExplorer
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Eric Klein
Top achievements
Rank 1
Share this question
or