关于Asp.net和javascript [英] About Asp.net and javascript

查看:73
本文介绍了关于Asp.net和javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net上使用文件上传控件尝试了这个代码

  if (FileUpload1.HasFile )
{


FileUpload1.SaveAs(Server.MapPath( 〜/ Uploads / + FileUpload1.FileName));
Label1.Text = 文件已成功上传;
Label1.ForeColor = System.Drawing.Color.Green;

Label1.Text = System.IO.Path.GetFullPath( 〜/ Uploads / + FileUpload1.FileName);
}
else
{
Label1.Text = 请选择任何文件;
Label1.ForeColor = System.Drawing.Color.Red;



当最终用户点击打印按钮时,它必须只打印所选文件,并且文件必须保存在服务器端,并且可以在客户端进行打印..如何使用Asp.net 4.5;

请发送详细信息

解决方案

在server.ie中保存文件后,成功消息文件已成功保存..请调用您的javascript如下...



 ScriptManager.RegisterStartupScript( this  this  .GetType(),Guid.NewGuid( ).ToString(),  javascript:yourPrintFunction()); 


I tried this code on asp.net using file upload control

if(FileUpload1.HasFile)
        {


     FileUpload1.SaveAs(Server.MapPath("~/Uploads/" +FileUpload1.FileName));
     Label1.Text=" file has uploaded sucessfully";
     Label1.ForeColor = System.Drawing.Color.Green;

     Label1.Text = System.IO.Path.GetFullPath("~/Uploads/"+FileUpload1.FileName);
        }
      else
      {
          Label1.Text="please select any file";
          Label1.ForeColor = System.Drawing.Color.Red;


when the end user clicks on print button it has to print only the selcted file,and the file has to save in server side and printing is possible on client side.. how its possible iam using Asp.net 4.5;
please send the details

解决方案

Once you saved your file in server.i.e., after the success message "File saved successfully.. call your javascript like following..

ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "javascript:yourPrintFunction()", true);


这篇关于关于Asp.net和javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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