Hi
Refer this code for you ques, this will be helpful for to open the any document in run time.
Step-1
Create applicetion:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
Height="64px" onselectedindexchanged="DropDownList1_SelectedIndexChanged"
Width="266px">
</asp:DropDownList>
</div>
</form>
</body>
</html>
Code using c#
********************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string[] objgetfiles = Directory.GetFiles(@"E:\Sarathy\Desktop");
if (objgetfiles.Length > 0)
{
for (int i = 0; i < objgetfiles.Length; i++)
{
DropDownList1.Items.Add(objgetfiles[i].ToString());
}
}
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(DropDownList1.SelectedItem.Text);
}
}
Parthasarathy.S
Gudevg, if this helps please login to Mark As Answer. | Alert Moderator