如何使用C#ASP .NET在按钮单击时从多个文档打开所选文档 [英] How to open the selected document from multiple documents on button click using C# ASP .NET

查看:97
本文介绍了如何使用C#ASP .NET在按钮单击时从多个文档打开所选文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要开发一个Web应用程序,当用户点击按钮 >在浏览器中。这是通过在我的应用程序文件夹中单个文档来完成的。**现在我需要获取多个文档并显示所有文档文件名用户点击浏览器中按钮时。我怎么能执行 。** 

< pre>< pre>

系统.Diagnostics.Process objDocProcess = new System.Diagnostics.Process();

objDocProcess.EnableRaisingEvents = false;

objDocProcess.StartInfo.FileName = Server.MapPath(@OpenOfficeDoc \ TestDoc.odt);

objDocProcess.Start();



如何修改我的代码,使其显示所有文件按钮上的名称单击


我尝试了什么:



i试过上面的代码,但怎么能我修改上面的代码,使其显示所有文件名

解决方案

嗯...你的代码是在服务器上启动文件,而不是客户端。你看到了它的问题吗?



所有的ASP.NET C#代码都完全在服务器上运行,而不是客户端。在浏览器中运行的代码将是您在.js文件中编写的Javascript代码,或者直接在< script>中的网页中编写的代码。标签

I need to develop a web application which opens the word document when users clicks the button in the browser.This was done by taking a single word document in my application folder.**Now i need to take multiple documents and display all the file names when user clicks the button in the browser.How can i do this.**

    <pre><pre>

System.Diagnostics.Process objDocProcess = new System.Diagnostics.Process();
objDocProcess.EnableRaisingEvents = false;
objDocProcess.StartInfo.FileName = Server.MapPath(@"OpenOfficeDoc\TestDoc.odt");
objDocProcess.Start();

How to modify my code such that it displays all the file names on button click

What I have tried:

i tried the above code but how can i modify my above code such that it displays all the file names

解决方案

Ummm... Your code is launching the documents ON THE SERVER, NOT THE CLIENT. Do you see a problem with that?

All of your ASP.NET C# code runs entirely on the server, never the client. Code running in the browser would be the Javascript code you write into a .js file or directly in a web page in a <script> tag.


这篇关于如何使用C#ASP .NET在按钮单击时从多个文档打开所选文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆