I would like to use the file explorer to look at the files that I upload. here is the issue I am running into. I only wnat to show the files for a person that are part of that record. So everyone has a record. If they upload files I put the file names in the database along with the ID of person whom uploaded them. Is there a way to only load the files in the file explorer that belong to that person whom uploaded them. Right now I am trying to view them as links and not working so well.
So is there a way to fill the fileExplorer with just the files I am picking in the sql statement.
Current method not working so well as link buttons caus ethey so not persist well in radwindow.
sql = "Select strUrl from PriorServiceUpload where intPriorServiceId = " & myDataTable.Rows(0)(0)
myDataTable = New DataTable
myDataTable = getReader(sql)
If myDataTable.Rows.Count > 0 Then
Dim attach As New LinkButton
For Each row As DataRow In myDataTable.Rows
attach.Text = row(0) & "<
br
>"
attach.CausesValidation = False
attach.CommandArgument = row(0)
Next
AddHandler attach.Click, AddressOf GetattachLink
phAttach.Controls.Add(attach)
End If
6 Answers, 1 is accepted
0
Hi Kevin,
You can achieve the desired behavior by filtering the files in the FileExplorer's ExplorerPopulated event-handler. This event is triggered two times - once for the TreeView and once for the Grid, so you can implement the files filtering in a similar manner:
Hope his helps.
Regards,
Vessy
Telerik
You can achieve the desired behavior by filtering the files in the FileExplorer's ExplorerPopulated event-handler. This event is triggered two times - once for the TreeView and once for the Grid, so you can implement the files filtering in a similar manner:
Private
userID
As
String
Protected
Sub
Page_Load(sender
As
Object
, e
As
EventArgs)
Handles
Me
.Load
..
AddHandler
radFileExplorer.ExplorerPopulated,
AddressOf
radFileExplorer_ExplorerPopulated
End
Sub
Protected
Sub
radFileExplorer_ExplorerPopulated(sender
As
Object
, e
As
RadFileExplorerPopulatedEventArgs)
Handles
radFileExplorer.ExplorerPopulated
userID =
"1234"
'your custom user ID accessing logic here
If
e.ControlName =
"grid"
Then
Dim
items
As
List(Of FileBrowserItem) = e.List
Dim
i
As
Integer
= 0
While
i < items.Count
If
Not
items(i).Name.Contains(userID)
Then
items.Remove(items(i))
Else
i += 1
End
If
End
While
End
If
End
Sub
Hope his helps.
Regards,
Vessy
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Kevin
Top achievements
Rank 1
answered on 02 Jul 2014, 03:59 PM
HI,
Ok i sort of have it working but am running into an error when 2 conditions happen on the page. The first is when I have uploaded multiple files it gives me an index error. The other thing is when I do a postback to upload the files and then come back the radfileExplorer says there are no files to show, but there should be, but when I totally reload the page from scratch it shows if I only have 1 file attached it works fine, but multiple files shows the error below.
Ok i sort of have it working but am running into an error when 2 conditions happen on the page. The first is when I have uploaded multiple files it gives me an index error. The other thing is when I do a postback to upload the files and then come back the radfileExplorer says there are no files to show, but there should be, but when I totally reload the page from scratch it shows if I only have 1 file attached it works fine, but multiple files shows the error below.
Private Sub radFileExplorer_ExplorerPopulated(sender As Object, e As RadFileExplorerPopulatedEventArgs) Handles radExplorer.ExplorerPopulated
If HFPriorService.Value > "" Then
sql = "Select strUrl from PriorServiceUpload where intPriorServiceId = " & HFPriorService.Value
myDataTable = New DataTable
myDataTable = getReader(sql)
If myDataTable.Rows.Count > 0 Then
If e.ControlName = "grid" Then
Dim items As List(Of FileBrowserItem) = e.List
Dim i As Integer = 0
While i < items.Count
For Each row As DataRow In myDataTable.Rows
If Not items(i).Name.Contains(row(0)) Then
items.Remove(items(i))
Else
i += 1
End If
Next
End While
End If
End If
End If
End Sub
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source Error:
Line 362: While i < items.Count
Line 363: For Each row As DataRow In myDataTable.Rows
Line 364: If Not items(i).Name.Contains(row(0)) Then
Line 365: items.Remove(items(i))
Line 366: Else
0

Kevin
Top achievements
Rank 1
answered on 02 Jul 2014, 05:27 PM
Hi,
Ok I think I get pas thte item index but now stuck on it only shows 1 file and only 1 file. I might have 4 files uploaded on this person but the first file it grabs is the only one it shows, even though there might be 4 files.
Also another nuance that I do not know how to solve is that on postback after uploading files, I need to know how to deal with file explorer on postback, cuae it wipes out the files and says no file avialable, when it should show updated files.
Ok I think I get pas thte item index but now stuck on it only shows 1 file and only 1 file. I might have 4 files uploaded on this person but the first file it grabs is the only one it shows, even though there might be 4 files.
Also another nuance that I do not know how to solve is that on postback after uploading files, I need to know how to deal with file explorer on postback, cuae it wipes out the files and says no file avialable, when it should show updated files.
Private Sub radFileExplorer_ExplorerPopulated(sender As Object, e As RadFileExplorerPopulatedEventArgs) Handles radExplorer.ExplorerPopulated
'If HFPriorService.Value > "" Then
sql = "Select strUrl from PriorServiceUpload where intPriorServiceId = " & HFPriorService.Value
myDataTable = New DataTable
myDataTable = getReader(sql)
If myDataTable.Rows.Count > 0 Then
If e.ControlName = "grid" Then
Dim items As List(Of FileBrowserItem) = e.List
Dim i As Integer = 0
For Each row As DataRow In myDataTable.Rows
While i < items.Count
If Not items(i).Name.Contains(row(0)) Then
items.Remove(items(i))
Else
i += 1
End If
End While
Next
End If
End If
'End If
End Sub
0
Hi Kevin,
Can you try moving the below hightlighted row into the for each statement and let me know how it goes?
to:
Regarding the second issue - the described behavior is not an expected one and I will need to debug the project on my side in order to be able to provide you more to the point answer. Please, try to isolate the issue following the steps from this blog post and send the prepared fully runnable project for a further investigation.
For the time being you can try enabling the AsyncUpload option in FileExplorer:
Regards,
Vessy
Telerik
Can you try moving the below hightlighted row into the for each statement and let me know how it goes?
If
e.ControlName =
"grid"
Then
Dim
items
As
List(Of FileBrowserItem) = e.List
Dim
i
As
Integer
= 0
For
Each
row
As
DataRow
In
myDataTable.Rows
While
i < items.Count
If
Not
items(i).Name.Contains(row(0))
Then
items.Remove(items(i))
Else
i += 1
End
If
End
While
Next
End
If
If
e.ControlName =
"grid"
Then
Dim
items
As
List(Of FileBrowserItem) = e.List
For
Each
row
As
DataRow
In
myDataTable.Rows
Dim
i
As
Integer
= 0
While
i < items.Count
If
Not
items(i).Name.Contains(row(0))
Then
items.Remove(items(i))
Else
i += 1
End
If
End
While
Next
End
If
Regarding the second issue - the described behavior is not an expected one and I will need to debug the project on my side in order to be able to provide you more to the point answer. Please, try to isolate the issue following the steps from this blog post and send the prepared fully runnable project for a further investigation.
For the time being you can try enabling the AsyncUpload option in FileExplorer:
Protected
Sub
Page_Load(sender
As
Object
, e
As
EventArgs)
Handles
Me
.Load
radFileExplorer.Configuration.EnableAsyncUpload =
True
End
Sub
Regards,
Vessy
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

Kevin
Top achievements
Rank 1
answered on 07 Jul 2014, 06:05 PM
Hi Vessy,
Ok changed the code, but now instead of the 1st file it says no records to display. I have changed this many ways, 3 things happen, error, No records or only ever the 1st record to show never more than 1.
Ok changed the code, but now instead of the 1st file it says no records to display. I have changed this many ways, 3 things happen, error, No records or only ever the 1st record to show never more than 1.
Private Sub radFileExplorer_ExplorerPopulated(sender As Object, e As RadFileExplorerPopulatedEventArgs) Handles radExplorer.ExplorerPopulated
'If HFPriorService.Value > "" Then
sql = "Select strUrl from PriorServiceUpload where intPriorServiceId = " & HFPriorService.Value
myDataTable = New DataTable
myDataTable = getReader(sql)
'If myDataTable.Rows.Count > 0 Then
' If e.ControlName = "grid" Then
' Dim items As List(Of FileBrowserItem) = e.List
' Dim i As Integer = 0
' For Each row As DataRow In myDataTable.Rows
' While i < items.Count
' If Not items(i).Name.Contains(row(0)) Then
' items.Remove(items(i))
' Else
' i += 1
' End If
' End While
' Next
' End If
'End If
If e.ControlName = "grid" Then
Dim items As List(Of FileBrowserItem) = e.List
For Each row As DataRow In myDataTable.Rows
Dim i As Integer = 0
While i < items.Count
If Not items(i).Name.Contains(row(0)) Then
items.Remove(items(i))
Else
i += 1
End If
End While
Next
End If
'End If
End Sub
0
Hi Kevin,
I examined your implementation in details and think that I found the cause of the problem. Please, refer my answer to your other post here: http://www.telerik.com/forums/fileexplorer-reload-on-postback
Regards,
Vessy
Telerik
I examined your implementation in details and think that I found the cause of the problem. Please, refer my answer to your other post here: http://www.telerik.com/forums/fileexplorer-reload-on-postback
Regards,
Vessy
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.