28 October, 2009
0 Comments
0 categories
If you want to open a network share with a LinkButton, you can set it’s href attribute manually with code behind:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Rvl.HelperTools.Website.Test" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:LinkButton ID="LinkButton1" runat="server">Show network share with LinkButton</asp:LinkButton> <a href="\\Myshare" id="showReportsButton">Show network share with Link</a> </div> </form> </body> </html>
/// <summary> /// Event fires on pageload /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { this.LinkButton1.Attributes["href"] = @"\\Myshare"; }
Tags: ASP .NET