Hi Fiko/Telerik Guys,
This is my mail in response to the FIKO's mail that I have received a quite a day ago.
Wat I want to do here is that :- I want to REFRESH the RADFILE EXPLORER whenever I delete the folder from my TREEVIEW CONTEXT MENU.
Below is the code snipttet that I have been using in my PROJECT :-
The below mentioned code is in CustomFileSystemProvider.cs class in App_Code folder.
Similary, the below mentioned code exist in the file named : FileSystem.cs Class
Both the above mentioned METHOS are running fine & Iam able to get the successful message as "FILE DELETED SUCCESSFULLY"
But after I got this message RADFILE EXPLORER does not gets REFERESHED ??
How can I REFRESH the RADFILE EXPLORER ?
After both the METHODS gets executed, the break point cursor moves on to the PAGE LOAD event of the page where I have placed my RADFILE EXPLORER .
It can be shown as below :--
I exactly dont know where I have been MISSING/LACKING to put my REFRESH code ???
Even if I can refresh the whole page that would be great ......... But hw ??
Let me show you an example :-
In the ATTACHED PIC , I have delete the highliglted folder (Sleepless in Seatlle) & it has been successfully deleted as shown in the message but it still exists in the TREE CONTEXT MENU.
Could you please tell how to handle it ???
Please help help help ??
Ajay Jamwal
This is my mail in response to the FIKO's mail that I have received a quite a day ago.
Wat I want to do here is that :- I want to REFRESH the RADFILE EXPLORER whenever I delete the folder from my TREEVIEW CONTEXT MENU.
Below is the code snipttet that I have been using in my PROJECT :-
The below mentioned code is in CustomFileSystemProvider.cs class in App_Code folder.
public override string DeleteDirectory(string virtualTargetPath) |
{ |
string physicalTargetPath; |
physicalTargetPath = this.GetPhysicalFromVirtualPath(virtualTargetPath); |
if (physicalTargetPath == null) |
return "The virtual path :" + virtualTargetPath + " cannot be converted to a physical path"; |
//if (!HasDeletePermission(physicalTargetPath)) |
//{ |
// string error = "You do not have delete permissions set to the '" + virtualTargetPath + "' folder"; |
// return error; |
//} |
//================Checking for the Delete permission for Source Folder as on 14th November 2009========================= |
if (!Dms_CheckFolderPermissions.GetAccessList(virtualTargetPath.TrimEnd('/')).Contains("F")) |
{ |
string error = "You do not have delete permissions set to the '" + virtualTargetPath + "' folder"; |
return error; |
} |
//======================================================================================================================= |
// There is not permission issue with the FileExplorer's permissions ==> Delete can be performed |
// but there can be some FileSystems' error |
string errorMessage = FileSystem.DeleteDirectory(physicalTargetPath, virtualTargetPath); |
return errorMessage; |
} |
Similary, the below mentioned code exist in the file named : FileSystem.cs Class
public static string DeleteDirectory(string physicalTargetPath, string virtualTargetPath) |
{ |
try |
{ |
string NewFolder_Name = ""; |
string FolderName = ""; |
string FolderPath = ""; |
physicalTargetPathphysicalTargetPath = physicalTargetPath.TrimEnd("\\".ToCharArray()); |
FolderName = physicalTargetPath.Substring(physicalTargetPath.LastIndexOf("\\") + 1); |
if (physicalTargetPath.Contains("SharedDocuments")) |
{ |
FolderPath = physicalTargetPath.Substring(physicalTargetPath.IndexOf("SharedDocuments")); |
NewFolder_Name = FolderPath.Replace("\\", "#") + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Hour.ToString() + "-" + DateTime.Now.Minute.ToString() + "-" + DateTime.Now.Second.ToString() + "-" + HttpContext.Current.Session["UserID"].ToString(); |
} |
if (physicalTargetPath.Contains("SharedDocuments")) |
{ |
Directory.Move(physicalTargetPath, physicalTargetPath.Substring(0, physicalTargetPath.IndexOf("SharedDocuments")) + "DeletedDocuments\\" + NewFolder_Name); |
} |
else |
{ |
Directory.Delete(physicalTargetPath, true);// physicalTargetPath.Substring(0, physicalTargetPath.IndexOf("FTPDocuments")) + "DeletedDocuments\\" + NewFolder_Name); |
} |
if (physicalTargetPath.Contains("SharedDocuments")) |
{ |
Glb_Entities.ExecuteSP(new object[] {"Usp_Dms_DeleteFolder" |
,"Folder_Name", FolderName |
,"NewFolder_Name", NewFolder_Name |
,"Folder_Path", FolderPath.Substring(FolderPath.IndexOf("SharedDocuments")).TrimEnd(FolderName.ToCharArray()).Replace("\\","/").TrimEnd("/".ToCharArray()) |
,"Folder_DeletedBy", HttpContext.Current.Session["UserID"].ToString() |
}); |
} |
} |
catch (DirectoryNotFoundException) |
{ |
string message = "FileSystem's restriction: Directory with name '" + virtualTargetPath + "' is not found!"; |
return message; |
} |
catch (UnauthorizedAccessException) |
{ |
string message = "FileSystem's restriction: You do not have enough permissions for this operation!"; |
return message; |
} |
catch (IOException) |
{ |
string message = "FileSystem's restriction: The directory '" + virtualTargetPath + "' cannot be deleted!"; |
return message; |
} |
return "Directory Deleted Successfully"; |
} |
Both the above mentioned METHOS are running fine & Iam able to get the successful message as "FILE DELETED SUCCESSFULLY"
But after I got this message RADFILE EXPLORER does not gets REFERESHED ??
How can I REFRESH the RADFILE EXPLORER ?
After both the METHODS gets executed, the break point cursor moves on to the PAGE LOAD event of the page where I have placed my RADFILE EXPLORER .
It can be shown as below :--
protected void Page_Load(object sender, EventArgs e) |
{ |
try |
{ |
if (Session["UserID"] == null) |
{ |
Session.Clear(); |
Response.Redirect("~/ExpiredMessage.aspx", false); |
} |
RadScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "PopForReport", "function newWindow(url) { var popupWindow = window.open(url,'popUpWindow','height=700,width=600,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no, location=no,directories=no, status=yes'); return false; }", true); |
RadScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ErrorHandler", "function handlerFunction(description,page,line) {return true;} window.onerror = handlerFunction;", true); |
RadScriptManager.RegisterClientScriptInclude(Page, Page.GetType(), "pasword_encrypt", "script/encode.js"); |
} |
catch (Exception exLoad) |
{ |
StackTrace stackError = new StackTrace(new StackFrame(true)); |
BLLError.SetErrorProperties(exLoad.Message, stackError, short.Parse(Session["UserID"].ToString())); |
} |
GetMappedPath GMP = new GetMappedPath(); |
Dictionary<string, string> mappedPathsInConfigFile = GMP.GetMappingsFromConfigFile(); |
string DocumentPath = ""; |
foreach (KeyValuePair<string, string> mappedPath in mappedPathsInConfigFile) |
{ |
DocumentPath = mappedPath.Value.Replace("/", "\\"); |
break; |
} |
string VirtualPath = Request["__EVENTARGUMENT"]; |
string EventTarget = Request["__EVENTTARGET"]; |
if (EventTarget == "Archive") |
{ |
if (VirtualPath.LastIndexOf("/") + 1 == VirtualPath.Length) |
{ |
Archive(VirtualPath, "Folder", DocumentPath); |
} |
else |
{ |
Archive(VirtualPath, "File", DocumentPath); |
} |
} |
string[] viewPaths = new string[] { DocumentPath }; |
string[] uploadPaths = new string[] { DocumentPath }; |
string[] deletePaths = new string[] { DocumentPath }; |
DocumentsRadFileExplorer.Configuration.ContentProviderTypeName = typeof(CustomFileSystemProvider).AssemblyQualifiedName; |
SetAccordToPermissions(viewPaths, uploadPaths, deletePaths); |
if (!IsPostBack) |
{ |
AddCreatedAndModifiedDate(); |
} |
} |
I exactly dont know where I have been MISSING/LACKING to put my REFRESH code ???
Even if I can refresh the whole page that would be great ......... But hw ??
Let me show you an example :-
In the ATTACHED PIC , I have delete the highliglted folder (Sleepless in Seatlle) & it has been successfully deleted as shown in the message but it still exists in the TREE CONTEXT MENU.
Could you please tell how to handle it ???
Please help help help ??
Ajay Jamwal