function DownloadFile(control) { $("#<%=hdnSelectedFile.ClientID%>").val(control.innerHTML); alert("hidden field value : " + $("#<%=hdnSelectedFile.ClientID%>").val()) $("#<%=btnDownloadFile.ClientID%>").click(); }
protected void btnDownloadFile_Click(object sender, EventArgs e) { try { // the file name to get string fileName = hdnPreviousUploadFileNames.Value; // get the file bytes to download to the browser string path = Server.MapPath(@"testpath\"); byte[] fileBytes = System.IO.File.ReadAllBytes(path + fileName); // NOTE: You could also read the file bytes from a database as well. StreamFileToBrowser(fileName, fileBytes); } catch (Exception ex) { } }
<asp:HiddenField ID="Hfproductid" runat="server" /> var hfproductid = document.getElementById('<%= Hfproductid.ClientID %>'); prod_id=100; hfproductid .innerHTML = prod_id; In My Code Behind ------------------ string invid = HfInvoices.Value; //invid =""; always
var hfproductid = document.getElementById('<%= Hfproductid.ClientID %>'); hfproductid .value=prod_id;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)