How to call javascript postback codebehind with same submit button
<p>I have a asp.net application display file names with treeview structure on the page.
After the user click on the checkbox to select the download files on the treeview then they can click the submit button.
First, I need to retrieve the checked(selected) node path value.
Second, pass all the node path with folder/file names to client javascript to downloading the files to local machine.  (we are using third party Softartisans XFile download which are using javascript function).</p>

<p>I was able to retrieve the nodepath value  with onclick at codebehind, but have problem to pass the value to javascript function.</p>

<p>My question is "There is any way I can call javascript function and pass the values AFTER the postback.  I have used ReisterArrayDeclaration, the codes as ..</p>

<pre><code>if (!IsPostBack)
{
dnlFile = getDownloadFile();
ClientScriptManager csm = Page.ClientScript;
csm.RegisterArrayDeclaration("dnlFile", dnlFile);
btnDownLink.Attributes.Add("OnClick", "btnFileDown_Click('" + dnlFile + "')");
}
protected void btnDownLoad_Click(object sender, EventArgs e)
{
  TreeView tv = tvFileDown;
  if (tv.CheckedNodes.Count &gt; 0)
  {
    foreach (TreeNode node in tv.CheckedNodes)
    {
      string strFilePath = Server.MapPath(initFolderPath + node.ValuePath);
      if (Directory.Exists(strFilePath))
      {
        lblSelectedNode.Text = node.ValuePath + ", ";
      }
      else
      {
        if (File.Exists(strFilePath))
        {
           dnFile.Add(node.ValuePath);
        }
      }
    }
    dnlFile = getDownloadFile();
  }
}

private string getDownloadFile()
{
   string downLoadFile = "";
   if (dnFile.Count &gt; 0)
   {
     for (var i = 0; i &lt; dnFile.Count; i++)
     {downLoadFile += dnFile[i].ToString() + ", ";}
   }
   lblFinalFilePath.Text = downLoadFile;
   return downLoadFile;
}
</code></pre>

<p>Thans advance for your help!!</p>
