Linkbutton to open Windows Explorer from Gridview
- by xt_20
Hi all,
I have a link in a Gridview that I want opened in Windows Explorer (or explorer.exe).
<asp:GridView ID="GridView1"runat="server" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="DeploymentLocation" runat="server" CommandName="OpenLink"
Text='<%# Eval("DeploymentLocation") %>' CommandArgument='<%# Eval("DeploymentLocation") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
and in codebehind I have this:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
Process.Start("explorer.exe", "/n," + e.CommandArgument.ToString());
}
Obviously this doesn't work as Process.Start only works if I have full permissions, etc, etc. I heard that I can use Javascript to do this, but haven't succeeded so far.
Basically, what I want is the exact link that is displayed in the grid to be opened when clicked. Any help would be much appreciated!
Thanks!