I am looking for a solution that will allow me to click a button or a hyperlink within a row and open a folder on our network. The location to be opened is stored in the record source for that grid.
I have tried a couple of things, both of which failed. Granted, the solution I have are either my own creation or a hybrid of my code and assistance from the forums.
FAILED SOLUTION #1
This column contains a button that opens the folder. This does work locally, but does not work when published to our web folder.
FAILED SOLUTION #2
This does nothing but reload the page.
I have tried a couple of things, both of which failed. Granted, the solution I have are either my own creation or a hybrid of my code and assistance from the forums.
FAILED SOLUTION #1
This column contains a button that opens the folder. This does work locally, but does not work when published to our web folder.
<
telerik:GridButtonColumn
FilterControlAltText
=
"Filter Files column"
CommandName
=
"ShowFiles"
UniqueName
=
"Files"
ButtonType
=
"PushButton"
HeaderText
=
"Files"
Exportable
=
"False"
Text
=
"Display"
>
</
telerik:GridButtonColumn
>
Protected
Sub
RadGrid1_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
Dim
value
As
String
If
e.CommandName =
"ShowFiles"
Then
Dim
dataItm
As
GridDataItem = TryCast(e.Item, GridDataItem)
value = dataItm(
"Location"
).Text &
"\03 Submitted\"
Process.Start(
"explorer.exe"
, value)
End
If
End
Sub
FAILED SOLUTION #2
This does nothing but reload the page.
<
telerik:GridTemplateColumn
UniqueName
=
"LinkColumn"
>
<
ItemTemplate
>
<
asp:LinkButton
runat
=
"server"
ID
=
"LinkButton1"
CommandName
=
"ShowFiles"
></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Private
Sub
RadGrid1_ItemDataBound(sender
As
Object
, e
As
GridItemEventArgs)
Handles
RadGrid1.ItemDataBound
If
TypeOf
e.Item
Is
GridDataItem
Then
Dim
item
As
GridDataItem = TryCast(e.Item, GridDataItem)
Dim
row
As
DataRow = TryCast(item.DataItem, DataRowView).Row
Dim
linkButton
As
LinkButton = TryCast(item(
"Location"
).FindControl(
"LinkButton1"
), LinkButton)
linkButton.Text =
"Location"
linkButton.PostBackUrl =
"#"
End
If
End
Sub
Protected
Sub
RadGrid1_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
Dim
value
As
String
If
e.CommandName =
"ShowFiles"
Then
Dim
linkButton
As
LinkButton = TryCast(e.CommandSource, LinkButton)
Dim
dataItm
As
GridDataItem = TryCast(e.Item, GridDataItem)
value = dataItm(
"Location"
).Text &
"\03 Submitted\"
Process.Start(
"explorer.exe"
, value)
End
If
End
Sub