protected void ButtonImportData_Click(object sender, EventArgs e)
    {
        ClientScript.RegisterClientScriptBlock(typeof(string), "js", "test();", true);
        string w = FileUpload3.FileName.ToString();
    }在前台我有一个TEST()的函数现在能成功调用
我现在有个问题,能不能在JS函数执行完后再执行 :string w = FileUpload3.FileName.ToString();
这一句??
THX

解决方案 »

  1.   

    不能。
    你可以在test()中用postback或者ajax等方式向后台提交数据,再另外处理。后台和前台的代码不可能交叉执行。
      

  2.   

    this.ButtonImportData.Attributes.Add("click", "javascript:test();");
    前后台分开执行。
      

  3.   

    在button的onclient执行
    test();或 
    this.ButtonImportData.Attributes.Add("click", "test();"); 
      

  4.   

    JavaScript:
      function test()
      {
         .......
      }.cs文件:
      protected void Page_Load(object sender, EventArgs e)
      {
         ButtonImportData.Attributes.Add("click", "test();");  
      }  protected void ButtonImportData_Click(object sender, EventArgs e) 
      { 
         string w = FileUpload3.FileName.ToString(); 
      } 
      

  5.   

    Dear all,都不行啊
    先结贴,自己琢磨下