<html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>Untitled Page</title> <%--Scenario1--%> <script language="javascript" type="text/javascript"> function filepath(txtval) { document.getElementById("txtpath").value= txtval.value; // Clear Fileupload var textpath=document.getElementsByName('<%=UploadFile.UniqueID%>')[0]; textpath.value=""; var textpath2= textpath.cloneNode(false); textpath2.onchange= textpath.onchange; textpath.parentNode.replaceChild(textpath2,textpath); } // right click and control click disabled // function enablecopypaste(ex){ // var message = "Cntrl key/ Right Click Option Enabled"; // // Condition to check mouse right click / Ctrl key press // if (ex.which == 0 || ex.button == 1) { // alert(message); // return false; // } // } </script> <%--for size <style type="text/css" > .size1{width:627px} </style>--%> </head> <body> <form id="form1" runat="server"> <div> <%--<asp:FileUpload ID="UploadFile" runat="server" onchange="filepath(this)" CssClass="size1" Width="627px"/><br />--%> <asp:FileUpload ID="UploadFile" runat="server" OnChange="filepath(this)" Width="610px" /><br /> <asp:TextBox ID="txtpath" runat="server" Width="521px"> <%-- onKeyDown="return enablecopypaste(event)" onMouseDown="return enablecopypaste(event)">--%> <br /> </div> </form> </body> </html>
You can get that fileupload control text but you can't set value due to security reasons so take some other textbox set value to that like C# txtFileUploaderValue.Text = FileUploader.Value if your missing value then store in view state variable and set to textbox
txtFileUploaderValue.Text = FileUploader.Value
var textpath=document.getElementsByName('<%=UploadFile.UniqueID%>')[0];
function ClearBrowseContent(control) { var browse = document.getElementById(control); var newbrowse = browse.cloneNode(false); browse.parentNode.replaceChild(newbrowse ,browse); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)